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 So if we keenly observe the 'Caused by' in logs that suggests the issue some times. As per the logs attached by you, accessing an invalid field in cdt is causing the issue.

    Caused by: java.lang.IllegalArgumentException: Invalid index: Cannot index property 'busrules_name' of type Text into type PRQ_Config_BusRules?list

    Now if we take a look at the cdt structure, busrule_name exists but busrules_name doesn't exist. So please correct the definition of displayvalue() in findBusinessRulesCDT rule accordingly, 2nd parameter is wrong here. And one more correction I would like to make here is, earlier you said that the same worked in process but it's not true I guess. As you refer the column from the PV, you might not have made a mistake. But in the rule, you are manually including the column name and so there has been a mistake which is causing the rule to fail.

    Please try the above suggestion and do let us know if you have any follow up questions or issues.
Reply
  • @briank So if we keenly observe the 'Caused by' in logs that suggests the issue some times. As per the logs attached by you, accessing an invalid field in cdt is causing the issue.

    Caused by: java.lang.IllegalArgumentException: Invalid index: Cannot index property 'busrules_name' of type Text into type PRQ_Config_BusRules?list

    Now if we take a look at the cdt structure, busrule_name exists but busrules_name doesn't exist. So please correct the definition of displayvalue() in findBusinessRulesCDT rule accordingly, 2nd parameter is wrong here. And one more correction I would like to make here is, earlier you said that the same worked in process but it's not true I guess. As you refer the column from the PV, you might not have made a mistake. But in the rule, you are manually including the column name and so there has been a mistake which is causing the rule to fail.

    Please try the above suggestion and do let us know if you have any follow up questions or issues.
Children
No Data