Remove All Formula

Hi,

In another low-code environment, I have access to a removeAll() function but I can’t seem to find the equivalent in WeWeb ?
Basically I have array 1 [“800”,“1000”,“1200”,“Green”,“Blue”,“700”] and array 2 [“800”,“1000”,“Green”] and with array1.removeAll(array2) I would get a new array as a result [“1200”,“Blue”,“700”]
Is there a way to do that in WeWeb without iterating through the list and using the remove function?

Thanks,
Jean

Mmh, yes it look like a missing feature. You can submit a feature request on feedback.weweb.io so we can add it on the roadmap.

You can implement it by yourself by creating a globalFormula named removeAll, taking two parameters, the first one would be the main array, the second one the list of items to remove (so, another array).

Param1 => array
Param2 => values
Here the JS code to put inside the formula


return array.filter(item => !values.includes(item))

it will works for any array containing primitives values like string and number, not object.

2 Likes

That Global Formula is working great! Thank you.