I am having problems writing an expression rule that uses displayvalue() functio

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

Parents
  • @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.
Reply
  • @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.
Children
No Data