You are referencing and using arrays of a CDT (Custom Data Type). Which two statements are true? (Choose two.)
A. Other Appian functions can be used within the square brackets "[]" when using dot notation to return specific data from the array.
B. There is no difference between using "dot notation" and the index() function.
C. An array of integers can be passed as the second parameter to the index() function to return the data at those position in the array.
D. The function where contains can act on operands of different types.
I think options B and C are correct. Option D is incorrect. However, option A is not clear to me.
The following code does not give any error:
Hence, is option A correct? If that is the case, which one is incorrect?
Discussion posts and replies are publicly visible
Hi,
the context of option A, I think the statement is not correct.
An array contains four elements {11,"test","abcd", 14} and the 4th element is 14. Hence, it returning the correct result. I don't see any issue with the result.
I think "length" function is working like that. If it is working, length will be 4.
local!data[length(local!data)] returning 14 i.e. 4th element. This is correct behavior.
a!localVariables( local!data: {11,"test", "abcd", 14}, local!data[length(local!data)] )
A and C are correct, B and D are incorrect.
B is, as mentioned, incorrect.
The reason why: using index() gets the location of an array, returning a separate copy of that data (if any). Square brackets refer directly to that position in the array, and can be used to access the value and also change the value within the original array (i.e. via an a!save() statement).
Chris & Mike Schmitt Thank you for your valuable comments.
Prasanta Paul said: I think the statement is not correct.
the test question states "other appian functions can be used" within the square brackets (which is true) - but this doesn't imply that you can use something nonsensical that fails to evaluate to a valid index of that array, which "proper(local!a)" would.