Pud24
4 years agoNew Contributor
Filter output from Sharepoint Online - Search Items Snap
I’m in the process of designing a pipeline which will read all of the .pgp files from a sharepoint document library and then delete any over X amount of days.
To do this I am first using a Sharepoi...
- 4 years ago
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))