Null value in Array

Hi All,

Can any one help me in how to check a null value in an Array? , isNull(ri!abc), where abc is an Array. which not working as we expecting .
Quick response will be appriciated.

OriginalPostID-250480

  Discussion posts and replies are publicly visible

Parents
  • If you want to just check if the array variable is itself null or Empty, you can use:
    or(local!myarray="", length(local!myarray)=0). This will work for any type of primitive array.

    If your array has few elements which are null, you can also use the reject function.
    Example: reject(fn!isnull, {1,3,2,null, 5}) . This will return {1,3,2,5}

    isnull() does not work on arrays as expected as you observed - the reason is that sometimes an array maybe empty but not null, When an array is empty isnull() will return false. And it is common in SAIL UI to set array variables to null or empty list.
    Either may happen, but in both the cases the isnull() behaves differently. It will be false for empty list, but true when it is actually null.
    So, its better to avoid using isnull to check for nullability of array variables.
Reply
  • If you want to just check if the array variable is itself null or Empty, you can use:
    or(local!myarray="", length(local!myarray)=0). This will work for any type of primitive array.

    If your array has few elements which are null, you can also use the reject function.
    Example: reject(fn!isnull, {1,3,2,null, 5}) . This will return {1,3,2,5}

    isnull() does not work on arrays as expected as you observed - the reason is that sometimes an array maybe empty but not null, When an array is empty isnull() will return false. And it is common in SAIL UI to set array variables to null or empty list.
    Either may happen, but in both the cases the isnull() behaves differently. It will be false for empty list, but true when it is actually null.
    So, its better to avoid using isnull to check for nullability of array variables.
Children
No Data