Hello!I'm having a doubt about the use of the function index(), as a best practice in Appian development.In the Appian documentation appears as: index( data, index, default ), but I know that we can use the function as: index( data, index, index, index... (as many as needed), default ), to navigate between an object and it returns the value needed.
The question is: Should I use nested index() functions? or Is better to use just one index function with many indexes inside?
Example:
{CountriesES, CountriesUS, CountriesNL} -> Cities -> Town
1 - Index(CountriesES, "Cities", "Town", null)
2 - Index(lIndex(CountriesES, "Cities", null), "Town", null).
Discussion posts and replies are publicly visible
I highly recommend only using 3 parameters in index function (normal behaviour). Using +3 params will work, but it is not the correct way to use so maybe in a future, Appian won´t support it. Instead of using nested index functions manually, I suggest you create a function like this:
reduce( index(_, _, a!defaultValue(ri!default, null)), ri!dictionary, ri!path )