Forum Discussion
j_angelevski
5 years agoContributor III
Hi @Pud24 ,
This is happening because you have array of objects and when you try to filter on createdDateTime, the filter snap will evaluate either to true or false but if a condition is true it will pass the whole array and if the condition is false nothing will pass.
You have to do the following:
- Use a JSON Splitter snap to split the data in the array into separate objects and then use the Filter snap and then use a Group by N snap to put all the documents into a single array agian.
- You can use a Mapper and the .filter() method, this will filter all values that do not match the criteria in the array but will leave the input as an array.
Use the following expression: $value.filter(val => Date.parse(val.get("createdDateTime")) < Date.now().minusDays(2))
Related Content
- 2 years ago
- 4 years ago