I have a local variable that holds an array. When I pass this local variable to a a!forEach items, it does not loop. When I take the array value and paste it directly into items, it works. Why is it not working when I pass in the array from the local variable?
a!localVariables( local!groups: { cons!AX_ALL_USERS, cons!AX_MECHANICS, cons!AX_REGISTRARS, cons!AX_SUPERVISORS, cons!AX_ADMINISTRATORS_POINTER }, { a!sectionLayout( label: "Groups for " & loggedInUser(), contents: { a!gridField( label: "", labelPosition: "ABOVE", data: todatasubset(a!forEach( /* WORKS */ items: { cons!AX_ALL_USERS, cons!AX_MECHANICS, cons!AX_REGISTRARS, cons!AX_SUPERVISORS, cons!AX_ADMINISTRATORS_POINTER }, /* DOES NOT WORK */ /*items: local!groups,*/ expression: { { groupName: group(fv!item, "groupName"), isMember: a!isUserMemberOfGroup(loggedInUser(), fv!item) } } ), fv!pagingInfo), columns: { a!gridColumn(label: "Group Name", value: fv!row.groupName.), a!gridColumn(label: "Member?", value: fv!row.isMember) }, validations: {} ) } ) } )
Discussion posts and replies are publicly visible
Your code, adapted to some of my groups, works as expected.
Could it be that you created that local variable later on, and did never hit the TEST button or refreshed the browser tab to allow Appian to evaluate the value assignment to that local?
When you add an empty local variable, and add a value later on, Appian will not automatically refresh that.