08-23-2018 06:23 AM
Hi All,
I’m looking to build a simple pipeline which can count the number of files in a directory, I have used the ‘Directory Browser’ Snap and ‘Aggregate’ snap (Count Function) and this works well. however I am struggling to get any output when there is no files in the directory. I have tried setting the ‘ignore empty result’ but I am unable aggregate the output of this result set.
Any suggestions for how to pass this condition. fairly sure there will be an obvious solution I am missing :). possible with a conditional snap but not sure how to determine if results are empty/null
Many thanks,
Kareem.
08-23-2018 08:02 AM
If you setup a JSON formatter WITHOUT setting the ignore empty result, an empty result will be returned as: . This works even if you have a filter preventing it. If you let data through… you get something more like: [{“test”:“HELLO”}]
Steve
08-24-2018 09:13 AM
You can add a json generator that generates one dummy record and union that to your directory browser, and then offset your count by 1. That way you always have a document to process for your snaps to execute.