Hi everyone,
I have a question regarding error handling. In my current workflow, I input many different excel files. In these files, I look for a keyword through the "contains" formula. After the search, the first row in the result data will be selected with the select tool.
Some of the files do contain the keyword, where others do not. Now, when the keyword does not exist in the file, I get an error that the select tool can not find the first row (which is logical as there is no output data in that case). However, I still want my workflow to continue, as it should still output some data to an excel file in my output tool. The problem is that the whole workflow stops running and no file will be written to my computer instead.
How can I make sure the workflow continues either way?
Thanks!
Solved! Go to Solution.
(What I described, is just a small part of the complete workflow, but relevant as it impacts the rest of the flow)
Hi @jor-di,
Which tool are you putting the formula in? If you use the Contains formula in a Filter tool it should not error. Without seeing your workflow, I would recommend using Sample or Select Records tool to get the first row of each file, then use the Filter tool with the contains formula to only get the rows you want.
hi @jor-di
You can use a technique similar to this
This is strategy used to ensure that there is always at least one record coming out of the final Select tool. In the NoRecordsFound input, add a value to a text column with the same name as the first text column in your input. After the next union, you'll always have either your records+NoRecordsInput or just the single NoRecordsInput row. After appending the record count the filter passes either just your records if the count is greater than one or the NoRecordsInput if the count = 1. In either case, you've always got at least one record.
This technique is usually used to add a "No Records Found" message to an output table if necessary, but you should be able to adapt it to your needs
Dan