Use the following JavaScript code to filter records on the presence or absence of a given value in a record array. When applying this filtration strategy, you must enable the JavaScript option in order to add the function. Click the JavaScript toggle filter at the top of the filter editor.
Here is an example record:
{
"record": {
"orderId": 123,
"total": 99.99,
"state": "ca",
"items": [
{
"description": "Hat",
"qty": 3
},
{
"description": "Shoes",
"qty": 1
}
]
}
}
Here is the JavaScript function:
function filter(options) {
for (var i = 0; i < options.record.items.length; i++) {
if (options.record.items[i].description === "Hat") {
return false;
}
}
return true;
}
If the function is set to "false" the record will be ignored. If the function returns "true" the record will be processed.