Forum Discussion
Hey @manohar,
The Filter snap functionality is based on the incoming objects, so for a specific condition, the filter snap will either pass or filter out that object. One way of filtering an array is with an expression in a Mapper snap.
I believe something like this should work:
$payload['order-lines'].filter(x=>x.status matches "soft_closed_for_receiving" | "soft_closed_for_invoicing").length > 0
If the result is false than the array is empty.
- manohar3 years agoContributor
Thank you very much @bojanvelevski.
sorry I was not clear enough.
Step 1. I need to filter out the Lines that have these 2 values. so the result List will have lines that have status other than the 2 values.
Step 2. now route based on if the list count is greater than 0 or if its 0.
any pointers for this.
Thanks
Manohar- bojanvelevski3 years agoValued Contributor
Then the expression will suffer a minor change:
$payload['order-lines'].filter(x=>!(x.status matches "soft_closed_for_receiving" | "soft_closed_for_invoicing")).length > 0
- manohar3 years agoContributor