Hi all, I'm having a bit of a problem with an expression I wrote.

A Score Level 1
Hi all,

I'm having a bit of a problem with an expression I wrote. The code is as follows:

if(rule!Utils_CheckIsNULLText(ri!PreferredProvider),ri!P_Values,if(
rule!getProviderByName(ri!PreferredProvider).IsActive=false(),insert(ri!P_Values,ri!PreferredProvider,1),ri!P_Values))

P_Values is a text array and PreferredProvider is text.

If PreferredProvider is null, the expression works as expected. If it is not null, instead of returning an array it returns the first item in the array.

Any ideas? It's got me stumped!

Thanks!...

OriginalPostID-99891

OriginalPostID-99891

  Discussion posts and replies are publicly visible

Parents
  • You can check couple of things in your expression.
    1) Check whether the pv that is used to store the result is multiple.
    2) I assume that the rule!getProviderByName is Query rule. In that case, there may be a chance of getting null as well as multiple result. So it is better to add null check for that rule. If the result is not empty, please pick any specific index value from the result and then compare that with the Boolean.
Reply
  • You can check couple of things in your expression.
    1) Check whether the pv that is used to store the result is multiple.
    2) I assume that the rule!getProviderByName is Query rule. In that case, there may be a chance of getting null as well as multiple result. So it is better to add null check for that rule. If the result is not empty, please pick any specific index value from the result and then compare that with the Boolean.
Children
No Data