Skip to main content
January 21, 2025
Solved

Issue with records to check if it's empty

  • January 21, 2025
  • 5 replies
  • 0 views

Why does the below peice of code does not work with records as rule input. 

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

If I pass empty record in ri!array it should return me true, but it is returning false.

    Best answer by andrewh6762

    This is similar but also different from  [mention:985d61621bea439cb480065e2d91370e:46448885d0e64133bbfbf0cd7b0fd6f7] so check that out for better code than just using the fn!isnull().

    Specifically for records I'd need to see more of your code. Records do work when passed into these rules but it does depend exactly what you are doing. If you just literally pass recordType!TEST TestRecord() then it shows as false.

    If you cast NULL to that same record type it all works fine.

    The exact same behaviour is observed with a!map() too.

    5 replies

    andrewh6762
    January 21, 2025

    This is similar but also different from  [mention:985d61621bea439cb480065e2d91370e:46448885d0e64133bbfbf0cd7b0fd6f7] so check that out for better code than just using the fn!isnull().

    Specifically for records I'd need to see more of your code. Records do work when passed into these rules but it does depend exactly what you are doing. If you just literally pass recordType!TEST TestRecord() then it shows as false.

    If you cast NULL to that same record type it all works fine.

    The exact same behaviour is observed with a!map() too.

    peter.lewis
    Employee
    January 21, 2025

    I'm not able to reproduce this - can you provide more information about what your input is?

    konduruc733182
    January 21, 2025

    In a different post it was mentioned that the user is trying to index related records. Which would return array of null values if the related records are not available. This would lead to a string of nulls. 

    community.appian.com/.../issue-to-check-related-record-if-its-empty

    (Assuming these questions are from the same team members)

    keshavd5650
    January 22, 2025

    Hi, probably you are trying with empty record, I guess.

    Like this

     

    If you are looking for a solution to check for a null record array, you can try this.


    Please let me know if this was helpful or if you are looking for something different.