HI everyone,
Could you help explain me how below code works? The character "_" is new to me and I cannot find any documentation for it.
apply( contains( index( local!childTask, "id", null ), _ ), index( local!parent, "id", null ) )
Discussion posts and replies are publicly visible
first thing first, Apply function has been replaced with foreach. Or I would say Foreach is better way of implementing looping logics.
In your case, - would be replaced with value of the id from parent variable.You can implement same logic with )
a!forEach( items: index( local!parent, "id", null ), expression: contains( index( local!childTask, "id", null ), fv!item ), )
hi mollyn126 '_ ' represents the current element being processed in the iteration.
_
Hello mollyn126
apply() evaluates the given rule or function for all the items in the given list. Where in the apply the 'function' parameter is similar to the 'Expression' that you write in the a!forEach() but would only be a function here.
The '_' defines the item in the array against which the function would be evaluated. We use '_' to iterate all the items in the given list in the 2nd parameter of the apply().
Also, Appian recommends to use the a!forEach() instead of apply() for better null handling.
docs.appian.com/.../fnc_looping_apply.html
Find the documentation here: https://docs.appian.com/suite/help/24.3/expression-advanced-evaluation.html
Can you help me understand what this code is meant to do? What is the outcome and what is that outcome used for?