Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
18 replies
Subscribers
8 subscribers
Views
5742 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
Hello everybody, a question about expressions and arrays here. I have
Jin Pheh
Certified Associate Developer
over 10 years ago
Hello everybody, a question about expressions and arrays here.
I have a function that takes an array of users.
I have multiple arrays of users that I want to call my function on after applying a merge (ie: I want to call my function on the first element of each array, then the second of each array, etc etc). However the apply function treats the result of a merge as individual arguments instead of a single array object when calling my expression. Wrapping the _ placeholder in the apply function with curly brackets causes a syntax error as does casting the result of the merge to a user list.
Has anyone dealt with this before and if so how did you resolve it?
OriginalPostID-138030
OriginalPostID-138030
Discussion posts and replies are publicly visible
Parents
0
Mike Schmitt
Certified Lead Developer
over 10 years ago
It still sounds doable to me; it sounds like you're saying your CDT has a mulitple-type integer component (let's call it CDT.UserIDs), and you'll be using an array of such CDTs.
Your sub-rule, I think, should be doing the check across the ID array of *one* CDT, such as: "apply(rule!checkUserIDActive, ri!thisCDT.UserIDs". (this would be rule "myFunction_sub", ri!thisCDT would be "any type")
You would then call this from a parent rule, such as this: apply(rule!myFunction_sub, local!arrayOfCDTs)
If you need to handle an array which will contain various different CDTs, all that really matters is that they either all contain a field named "UserIDs" or at least a set of such property names that you know up-front (like one has "UserIDs" but another one has "LoginIDs"). You would simply use the property() function in myFunction_sub to check which 'IDs' property the CDT member has prior to doing the apply.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
Mike Schmitt
Certified Lead Developer
over 10 years ago
It still sounds doable to me; it sounds like you're saying your CDT has a mulitple-type integer component (let's call it CDT.UserIDs), and you'll be using an array of such CDTs.
Your sub-rule, I think, should be doing the check across the ID array of *one* CDT, such as: "apply(rule!checkUserIDActive, ri!thisCDT.UserIDs". (this would be rule "myFunction_sub", ri!thisCDT would be "any type")
You would then call this from a parent rule, such as this: apply(rule!myFunction_sub, local!arrayOfCDTs)
If you need to handle an array which will contain various different CDTs, all that really matters is that they either all contain a field named "UserIDs" or at least a set of such property names that you know up-front (like one has "UserIDs" but another one has "LoginIDs"). You would simply use the property() function in myFunction_sub to check which 'IDs' property the CDT member has prior to doing the apply.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data