Issue with records to check if it's empty

Certified Associate Developer

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.

  Discussion posts and replies are publicly visible

  • This is similar but also different from  Issue to check related record if its empty 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.

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

  • 0
    Certified Senior Developer
    in reply to Peter Lewis

    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)

  • 0
    Certified Senior Developer

    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.

  • 0
    Certified Associate Developer
    in reply to Peter Lewis

    My input is an empty record