Hi,
I have the following code:
a!gridTextColumn( label: "Approved By", field: "approvedString", data: index(local!datasubset.data,"approvedString", null))
That returns a text array:
111, 222, 333
I want to send each of these array elements to expression rule!convertID that will convert it to a username.
For example:
Please can someone please tell me the syntax to apply the the rule!convertID to each element returned by data: index(local!datasubset.data,"approvedString", null))?
Thank you.
Discussion posts and replies are publicly visible
One issue I see immediately with your apply function (and which everyone else here so far has missed) is that you're returning "null()" as the default result of your index() function inside the data: parameter of a!gridTextColumn. There's a chance this won't do anything bad, but in the case where your datasubset is empty (or filtered down to empty), null() will cause an error -- you should always use the empty set ("{}") there instead. Also you should really call out the rule input specifically when you apply() over your helper rule.
The result of my 2 suggested changes would look like this:
a!gridTextColumn( label: "Approved By", field: "approvedString", data: apply( rule!TVP_getusersname( userName: _ ), index( local!datasubset.data, "approvedString", {} ) ) )
The screenshot I sent with the 3 duplicated usernames is just an example for testing. In production, those 3 usernames will be different.
The problem isn't that there are 3 "duplicated" usernames - it's the fact that (as far as we can see from your screenshot), each entry of local!dataSubset.data.approvedString is not one but 3 user IDs - you're passing all 3 IDs into your expression rule, and it is not understanding the input it's getting. Can you post the code you're using to construct local!dataSubset? That might help us find the real issue here.