Skip to main content
dinesha5713
Known Participant
Oct 29, 2024 10:29 AM UTC
Question

Index Function vs Square Bracket

In Appian we can use a records fields by square bracket notation or index or dot notation.

what to use where ,what is the best practices , i heard indexing is the best.in some places its not working ,i don't have clear understating  

12 replies

karumurua531442
Participating Frequently
Oct 29, 2024 10:52 AM UTC

hi [mention:30bb505c1ca4449ca754b36b7a8ed1d7:e9ed411860ed4f2ba0265705b8793d05]  There is one important difference. index() returns a copy of the data.  square-bracket-notation returns a reference to the original data. it is crucial for using more complex data structures in saveInto where index() might not work.

dinesha5713
Known Participant
Oct 29, 2024 11:23 AM UTC

how do i test that or know and what is the different between copy of the data and  reference to the original data

karumurua531442
Participating Frequently
Oct 29, 2024 11:30 AM UTC

hi [mention:30bb505c1ca4449ca754b36b7a8ed1d7:e9ed411860ed4f2ba0265705b8793d05]  try taking some text field component and have one saveinto with square bracket logic and another with index. you might see the difference

venkatrea696188
Inspiring
Oct 29, 2024 11:29 AM UTC

https://community.appian.com/discussions/f/general/35388/index-function-or-index-by-the-dot-in-a-variable-example-local-user-name This thread might help ,

plus point of index function is it help's in handling null values 

. it is crucial for using more complex data structures in saveInto where index() might not work.

This is the drawback of index function

dinesha5713
Known Participant
Nov 14, 2024 9:48 AM UTC


Its access denied