Input [ { "storeNumber": 1, "storeDescription": "Test", "storeBrand": "John", "brandCode": 101, "dieselBrand": "Brand1", "gasolineBrand": "Brand2", "isDealer": false }, { "storeNumber": 2, "storeDescription": "Test", "storeBrand": "John", "brandCode": 102, "dieselBrand": "Brand1", "gasolineBrand": "Brand2", "isDealer": false }, { "storeNumber": 33, "storeDescription": "Test", "storeBrand": "John", "brandCode": 101, "dieselBrand": "Brand1", "gasolineBrand": "Brand2", "isDealer": true }, { "store number": 666, "store description": null, "store-brand": null, "brand code": null, "dieselBrand": null, "gasolineBrand": null, "isDealer": false } ] And here is the DW code
output application/json var brandCode = 262 var isDealer = null
payload filter
// FILTER ONLY BY BRAND CODE
(((brandCode != null) and (brandCode contains $.brandCode) and (isDealer == null))
// FILTER BY BRAND CODE AND IS DEALER
or ((brandCode != null) and (brandCode contains $.brandCode) and ($.isDealer == isDealer))
// FILTER ONLY BY IS DEALER
or ((brandCode == null) and ($.isDealer == isDealer))
// NO FILTER
or ((brandCode == null) and (isDealer == null)))
PROBLEM: If I want to add 2 more filter criteria it will be very complicated and I would like to know if someone knows a simple solution for this filtering.
I need to filter the payload based on locationId, statusCode and status. I need to be able to filter after multiple values, for example locationId: 1,2 statusCode: 102 class: "Close" and also if I don't have any value the filter will be ignored.