Issue to check related record if its empty

Certified Associate Developer

Hi,

When we give empty related record in place of ri!array in below code it should give me true as a result but instead it is giving false

if(
  fn!isnull(ri!array),
  true(),
  length(ri!array) = 0
)


Here local!lrrfRec is the record and rgracslblLrrfSelectedCountries is the related record. We are passing this in place of ri!array.

Please correct me if I'm missing something in the above code.

  Discussion posts and replies are publicly visible

Parents
  • You can also just drop the if statement as it is redundant. The good thing about this condensed version is that the or() stops when it gets a single TRUE so as long as the length() after the a!isNullOrEmpty() then you never get the "A null parameter has been passed" error for the length() function.

    or(a!isNullOrEmpty(ri!array), length(ri!array) = 0)

    Having said that you can always use a!flatten() inside the length() function as length() can handle a list of null. The below code won't error even if given a null.

    or(length(a!flatten(ri!array)) = 0, a!isNullOrEmpty(ri!array))

Reply
  • You can also just drop the if statement as it is redundant. The good thing about this condensed version is that the or() stops when it gets a single TRUE so as long as the length() after the a!isNullOrEmpty() then you never get the "A null parameter has been passed" error for the length() function.

    or(a!isNullOrEmpty(ri!array), length(ri!array) = 0)

    Having said that you can always use a!flatten() inside the length() function as length() can handle a list of null. The below code won't error even if given a null.

    or(length(a!flatten(ri!array)) = 0, a!isNullOrEmpty(ri!array))

Children
No Data