Remove empty keys from array

Hi everyone!

I’m currently working on an array from which I’m trying to remove keys with no values. The structure looks like that:

Screenshot 2024-09-17 202010

I tried several options but I’m not able to remove my empty keys. The last try was {{remove(128.interventions_dates; null; emptystring)}} but it did not work.

Could someone have an idea?

Thanks!! :smile:

Easiest way to do it is you could remove them by using a iterator and a filter. Then use an aggregator to bring it back all together.

If you want to use inline functions i would suggest you first use the sort function to order it so the empty values are at the end. Then you can use the slice function to remove the items of an array up to a certain item. You can get the value of the end by using the contains() function to find how many items in the array are empty. Then subtract that from the total number of arrays items.

Hope this helps!

2 Likes

Hi @LinkYourTech!

First solution with iterator and filter works perfectly. It looks so simple when you know it :smile:

Thanks a lot!!

1 Like