Skip to main content
Known Participant
Jan 30, 2024 11:17 AM UTC
Question

Handle Nulls in a Record type

Hi Everyone,

How to handle null values in a recordtype?

My output is like this where first index is nul. To exlcude that in recordtype what needs to be done as i have used reject function as well but it will only work for an array.

Can someone please help me on this?

    4 replies

    stefanhelzle0001
    Brainy
    Jan 30, 2024 11:45 AM UTC

    I would try to identify the code that creates this null values and change that ...

    jayaprakashr0001
    Participating Frequently
    Jan 31, 2024 5:35 AM UTC

    Hi [mention:7657ae9700494c9ab3ce96484c26f54a:e9ed411860ed4f2ba0265705b8793d05] ,

    empty record also consider as single item and  not a null value. If possible can you share the code where these rows are getting created.

    harshitb6843
    Brainy
    Jan 31, 2024 6:38 AM UTC

    You can build your own custom null check rule for records like I have done. In the code below, ri!record is of ANY type. 

    and(
      a!forEach(
        items: a!keys(ri!record),
        expression: a!isNullOrEmpty(index(ri!record, fv!item, null))
      )
    )

    NOTE: This will only validate a single record and not a list. So you can add it in your reject function and it should work there. 

    gopuh0001Author
    Known Participant
    Feb 5, 2024 9:29 AM UTC

    yes its working. Thank You!!