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
21 replies
Subscribers
7 subscribers
Views
8547 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
I am having problems writing an expression rule that uses displayvalue() functio
briank538
over 8 years ago
I am having problems writing an expression rule that uses displayvalue() function.
I have an array CDT called BusinessRulesCDT. It keeps erroring out complaining about the 4th argument to displayvalue() which is the default value.
At run time, it gives the error message:
Details: ERROR:An error occurred while evaluating expression: businessRule:rule!findBusinessRuleCDT(pv!businessRuleArray, pv!ruleName,pv!defaultBusinessRule) (Expression evaluation error in rule 'findbusinessrulecdt' at function 'displayvalue' parameter 4: ) (Data Outputs)
My BusinessRuleCDT is:
- id (integer)
- name (text)
- value (text)
my expression rule is:
findBusinessRuleCDT(businessRuleArray (Any Type), ruleName (Text), defaultBusinessRule (Any Type))
which calls ==> displayvalue(ri!ruleName, ri!businessRuleArray.name, ri!businessRuleArray, ri!defaultBusinessRule)
For the 4th parameter, I tried {}, "", and even the example above where I pass ...
OriginalPostID-170427
OriginalPostID-170427
Discussion posts and replies are publicly visible
0
briank538
over 8 years ago
...in a default CDT in.
I keep getting the same errors.
Am I missing something or is this not supported in an expression? I got it work directly calling displayvalue(), but not in an expression rule. Help!
Thanks.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
vinitl522
A Score Level 2
over 8 years ago
keep the 4th value as {}
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
briank538
over 8 years ago
I tried that. Didn't work. I'm on 7.9. I don't know if that makes a difference.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
vineeta6579
over 8 years ago
I tested same use case on 7.9 version and it worked. can you please provide screenshot of it (expression rule & process snippet from where the expression rule is getting called).
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
briank538
over 8 years ago
Here you go.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Mike James
Certified Lead Developer
over 8 years ago
I also get the appropriate results when testing the expression in isolation. As with vahluwalia, this leads me to believe that the issue must exist with the way you are calling the rule - namely the default value. What is the value of ri!defaultBusinessRule you are passing in? Are you just trying to pass in an empty CDT or does this have actual default value?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
briank538
over 8 years ago
I tried placing {}, "", and finally passing into my expression rule a default value where I pass in a pv of that CDT type. Even that blows up with the same exact error on the 4th parameter to the displayvalue() which is the default value argument.
It only seems to work if I use displayvalue() straight on instead of abstracting it away in an expression rule.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
briank538
over 8 years ago
vinitl522/mikej, I have no problems calling displayvalue() directly. It's when I use it in an expression rule it fails.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
briank538
over 8 years ago
I'd like to abstract away the complexity of the CDT's I am designing by writing helper expression rules. If displayvalue() can't be used inside an expression rule, do you have any suggestions on an alternative method to find and return a CDT from inside an expression rule?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 8 years ago
@briank Definitely there are other ways of doing it, but I opine that it's not a great idea to deviate from usage of fn!displayvalue() just because of the reason that it's throwing an error when being wrapped inside an expression rule. I would like to suggest to resolve the issue - If possible I would like to suggest to cross check the data types of the arguments and values of the arguments that were being passed to the expression rule. As long as the data types of the arguments and the values passed to them(check the data type of the PV as well at the same time) are perfect, then fn!displayvalue() should also work. If possible I would like to suggest you to review logs when you are experiencing this error.
I might be wrong with this particular point, but I would like to suggest to use fn! as the context for displayvalue, just in case to avoid collision with a rule created (if any) with same name.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
>