How to change fields in an object with for each loop and conditional if?

Options

Hi,

I want to loop through the fields in an object and set fields with a null value to contain the string "empty" instead. I'm trying to do it like this:

But when I hit the stop and debug, all the null fields in the object are still null.

What am I doing wrong here?

Thanks in advance.

Answers

  • Pawel Magdanski
    Pawel Magdanski Member ✭✭✭
    Options

    Hi,

    From what i can see when you used values filter on the object you pretty much turn in into list of values that no longer relates to that object so then when you are looping through every single one of the you are not updating a field in an object but a separate and completely new entity created by the filter.

  • jd4syth
    jd4syth Member
    Options

    Okay, makes sense. How would you do what I'm trying to do?

  • Pawel Magdanski
    Pawel Magdanski Member ✭✭✭
    Options

    One way which is not very clean would be to use encode json filter then use replace filter to change null to empty and decode again. Remember to replace with empty as a string so "empty".

    To propose something better let me see how the object looks like