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
Discussion posts and replies are publicly visible
hi Dinesh Arumugam 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.
how do i test that or know and what is the different between copy of the data and reference to the original data
hi Dinesh Arumugam try taking some text field component and have one saveinto with square bracket logic and another with index. you might see the difference
if we use index(in target) in saveInto the null value only be saved in ri right
The issue with index() is, that it returns a copy of the data, but not a reference. Square brackets return a reference you can use as a saveInto target.
which means index duplicating the actual values and storing them in a new memory location(local) right?ex : local!a : index(ri!detail,1,null)
Correct
and Square brackets is a pointer or link to the original data right ?to understand this i coded :
the 6th line : its pointing to original data .
but when i try to change the local!b, the original data not getting changed ,
if this is wrong code plz show me a code to understand the difference between copy of the data,reference
Correct. The difference between a reference and the actual value is a very basic programming concept and you will find a lot of explanations in the internet.
I think the practical upshot most of the time is that the square brackets are far more susceptible to pink box crashes. I've not seen a tremendous problem with using index() all the time.