Formula - Removing empty choice from array

I struggled a little bit with this, unsure of what functions to use to achieve the result I wanted.

remove(sort(rollup(collections['7d31ab16-fa2e-419b-8ea4-6d07a65c3b04']['data'], 'typeBilan', true)),'')

I eventually used remove, as it was the simplest.
I wonder if there are other ways of achieving the same result.

Without remove:

You probably want to use a filter function, either in js or in no code (depending on your condition)

Is there a filter function that applies to an array? It’s how I’d have done it using JS. Something like a loop + filter to filter out all values that don’t match the filter predicate.

I also looked for “trim” and “isEmpty (string)” functions but couldn’t find anything like that.

My current solution works well, but I like to understand if there are other alternatives, as I’ll probably need them in the future :slight_smile:

The filters are OK when you know what you are looking for, but inserting a little Javascript can be handy. You can activate that escape hatch by switching the drop-down from formula to javascript. At that point, higher order functions like filter/map are available to you to tersely handle more complex data manipulation tasks.

1 Like