This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
A common use case is you have scheduled workflow with an input file which is updated each week, but sometimes there is no new data. You would like to stop the workflow outputting and overwriting your output file if there are zero records in the workflow. In this particular use case you will want to add a count and test tool before your output tool to make sure no records pass to the output tool.
Adding a count tool will give you the value you need to see if any records are present in the workflow. If the count is 0 it means there no records present, if it greater than this there are records present and you would like the workflow to continue as designed.
When you attach the test tool to the count tool, you will need to hit the ‘Add’ button to create a test scenario.
When you hit add it will pop out another window.
In this window you can enter your test name which will populate in the results window error log. The input connection is the data stream. And the Test type reflects the type of test you would like to apply. In this particular example we will be using ‘Expression is True for All Records’.
The Test value field will give you a window similar to the formula tool. In here you can create your expression. The test tool works when a user-specified condition is not met. Therefore, the in this particular case I am looking for no data so having count less than 0 will error when there is no data available.
Once you have configured the test tool and attached it in the workflow. You need to click on the canvas and navigate to ‘Runtime’ in the configuration window. In here there are a list of tick boxes, you will have to tick ‘Cancel workflow on error’. This will work in tandem with the test tool to cancel the workflow when the error is generated.
Here is a screenshot of the sample workflow.
I have also attached the example workflow! (Built in Alteryx Designer v10.1)