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
7 replies
Subscribers
8 subscribers
Views
4269 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
I'm working on an expression rule that takes two inputs: an integer value (f
robbier
over 10 years ago
I'm working on an expression rule that takes two inputs: an integer value (fieldname is key), and a CDT array (AnyType) where one of the fields I want to search on is named Key..so MyCDT.Key. The expression rule is actually more complex then this but to isolate my issue I am giving only the specifics here. Anyhow, here is the rule:
= load(
wherecontains(
ri!key,
ri!MyCDT.Key
)
)
I'm getting the following error:
"There was an error testing the rule:
Expression evaluation error at function 'wherecontains' parameter 2 [line 2]:"
I'm pretty certain this has to do with the fact that something is lost in passing something over to the expression rule--that it has no clue what this AnyType is. Perhaps I need to do an explicit cast of my AnyType into a CDT array?
OriginalPostID-140688
OriginalPostID-140688
Discussion posts and replies are publicly visible
Parents
0
darbyk
Certified Lead Developer
over 10 years ago
Hi Robbier, how are you trying to test this rule? It seems like you may be trying to directly test your load(wherecontains(...)) rule from the same rule interface, in which case you would receive the error message you're receiving. Since this rule has an Any Type parameter as an input, I'd try to invoke your rule from another rule. In addition, I would avoid using the load here if possible, can you use a with instead?
Something like this worked for me. Hope this helps.
RuleA:
=with(
myResult: wherecontains(
ri!key,
tointeger(ri!myCDT.Key)
),
myResult
)
RuleB:
rule!RuleA(2, {{Key: 1}, {Key: 2}, {Key: 3}})
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
darbyk
Certified Lead Developer
over 10 years ago
Hi Robbier, how are you trying to test this rule? It seems like you may be trying to directly test your load(wherecontains(...)) rule from the same rule interface, in which case you would receive the error message you're receiving. Since this rule has an Any Type parameter as an input, I'd try to invoke your rule from another rule. In addition, I would avoid using the load here if possible, can you use a with instead?
Something like this worked for me. Hope this helps.
RuleA:
=with(
myResult: wherecontains(
ri!key,
tointeger(ri!myCDT.Key)
),
myResult
)
RuleB:
rule!RuleA(2, {{Key: 1}, {Key: 2}, {Key: 3}})
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data