What is the key difference between the property() & index() function?Can anybody tell?
Discussion posts and replies are publicly visible
Details on each of are provided in Appian documentation:
Both functions do the same thing in the same way, as is (vaguely) noted in the documentation.
However, I strongly recommend as a Best Practice, to use them separately, as follows:
This is most important to me since it makes it dramatically easier to read through code afterwards if you're not having to guess whether this "index()" call is trying to find a property or an array index, which can get pretty messy especially when the functions are nested.
There's also a discussion here regarding some of the possible unexpected behaviour when using index() in certain ways.
The Property() function is used for accessing fields or properties of a data type.
Property()
The Index() function is used for retrieving elements from a list or array based on their position.
Index()
For Example:
a!localVariables( local!employee: a!recordType( field1: "John", field2: "karthik" ), local!employeeList: {"Alice", "Bob", "Charlie"} ), a!section( a!textField( label: "First Name:", value: property!employee.field1 ), a!textField( label: "Second Name:", value: index(local!employeeList, 1) ) )
My respect for replying to a six year old conversation, explaining the same topic a fourth time.
There is a small mistake in your code snippet. A "property!" domain does not exist in Appian.