11-10-2022 07:50 AM
Hi All,
Apologies if this one has been asked before.
There is a scenario in the current pipeline being developed where after a filter operation the number of documents returned can be 0. at this point the pipeline completes as there is no further processing to be done.
I am looking for a pattern to capture this scenario so when there are 0 documents after this step in the process to throw an exception rather than fail silently.
has anyone come across this issue before?
Many thanks,
Kareem.
Solved! Go to Solution.
11-10-2022 09:00 AM
HI @ksalem,
You can build a mechanism that will check for existing documents, by using the Gate snap.
The Gate Snap will move the pipeline flow even if no documents are provided on the input. From there you can simply add a router that will check for documents (Ex. $input.lenght == 0
) and throw an error by using the Exit snap.
Hope this helps,
Bojan
11-10-2022 09:00 AM
HI @ksalem,
You can build a mechanism that will check for existing documents, by using the Gate snap.
The Gate Snap will move the pipeline flow even if no documents are provided on the input. From there you can simply add a router that will check for documents (Ex. $input.lenght == 0
) and throw an error by using the Exit snap.
Hope this helps,
Bojan
11-10-2022 09:21 AM
Thanks Bojan,
Thats exactly what I’m looking for!
11-10-2022 09:35 AM
Be careful with the Gate snap if the output of the filter could potentially be thousands of documents, or even hundreds of documents if they’re large documents. The Gate snap has a setting called Output Document Content which defaults to “All input documents”. That could result in a very memory-intensive output document. Since you’re only using this to test for no input, consider changing this setting to one of the other two options:
If there are no input documents, the output document will look like this: