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
Thanks ammireddys,
I'm using V16.3 so can not use forEach function.
I updated my statement below, but I'm still getting evaluation error -->
a!gridTextColumn(
label: "Approved By",
field: "approvedString",
data: apply(rule!AH_formatUserName, {local!datasubset.data, "approvedString"})
)
Note:
The following text array is correctly returned by the below statement: {111,222,333}
data: index(
local!datasubset.data,
"approvedString",
null
Thank you, I'm getting evaluation error as follows:
Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error in rule 'ah_formatusername' at function 'user' [line 3]: Error evaluating function 'user' : [InvalidUserException]
rule!AH_formatUserName contains the following expression to handle a single userName input:
=if(a!isNullOrEmpty(ri!username),
tostring(null),
user(ri!userName, "firstName") & " " & user(ri!userName, "lastName")
Any other suggestions will be much appreciated.
Approved string holds a text array of userIDs. The user IDs are numeric (111111) and can convert to a full user name i.e. John Smith.
I copied this "approvedString" variable directly from one of the processes:
206504320, 206504472, 206504472, 206504472, 206504472, 206504472, 206504472, 206504472
Example:
rule!AH_formatUserName(206504472) RETURNS "John Smith"
Hi ammireddys,
"approvedString" holds a text array of numeric User IDs which are the usernames in Appian.
From the username, the rule AH_formatUserName returns "Firstname Lastname"
I am trying to take the username, and return the "firstname lastname".
Username: 206504476
Firstname: John
Lastname: Doe
rule!formatUserName(206504476) RETURNS "John Doe"
the rule does not accept arrays, only single user names.
Will your below code still work in this case?
a!gridTextColumn( label: "Approved By", field: "approvedString", data: apply( rule!AH_formatUserName, index( local!datasubset.data, "approvedString", null ) ) )
hi rizviz, once try below code,and make sure that rule input of rule rule!AH_formatUserName must be of type "text" because the approvedString is text Array a!gridTextColumn( label: "Approved By", field: "approvedString", data: apply( rule!AH_formatUserName(_), index( local!datasubset.data, "approvedString", null ) ) )