โ08-03-2022 02:55 AM
I am trying to figure out how to route to a โno dataโ path when nothing is returned from my select query. Can someone help me out?
What Iโve tried is (in โIs there data?โ snap): $retval != null (then go to data path); otherwise, go to nodata path. But Iโm guessing since the select didnโt return anything, there is no $retval to look at (catch22).
I also tried:
โ08-03-2022 04:24 AM
Hi,
You can try using the gate snap after Oracle execute snap. Gate snap will always provide the output, even if there is no data then an empty array will be there. In the router check $input0.length > 0 for records else true. Add the splitter snap in the output view of where records were found and split data.
โ08-03-2022 07:02 AM
This is what I got to work last night, which to me at least seems a little more straight forward. Basically, Oracle snap does union with a dummy record with the desired value to make it take the โno dataโ path. When I check for no data, Iโm assuming it is using the โAUDIT_COUNTโ value (this is the column Iโm using for the data/nodata decision snap), of the first record because itโs working correctly every time. Then, if there are records other than the dummy record, I filter out the dummy record so it doesnโt show up in the csv that gets emailed.
โ08-03-2022 09:23 AM
Rather than returning a dummy record, you could also check the returned document equal to an empty object. For example:
$ == {}
This can be your Router check condition if no data was returned by the select since if anything was returned, it would not be an empty object.
โ08-03-2022 10:22 AM
Ok, thanks