Hi @earth2joy ,
the way to do this is to use a detour tool, but to do this, the part of your workflow will need to be in a macro so you can feed in the record count as a parameter, this will then allow you to connect the control parameter to the Detour tool and determine if it will go left or right.
You need to close off the detour with the Detour End tool.
You can read more about these tools here:
https://help.alteryx.com/current/designer/detour-tool
I hope this helps,
M.
I have to say - I am a bit confused. If there are no records then there is no workflow execution. Workflow execution stops when there are no records being processed - ie if there are no records, that section of your workstream should automatically be skipped.
@mceleaveyam I missing something? I've seen the opposite question (ie how to generate output when there are no records) and get why that can be confusing, but no records means no workflow.
Hi @apathetichell ,
Yes, there are a couple of reasons for this, the first is when you actually want to perform different actions if there are no records, in which case you would use the detour based on record count to carry out a different section of the workflow.
Secondly, there are tools that could actually throw an error when no records are present, and so to prevent downstream errors you detour around that section if the record if zero.
It depends on the use case but I have often had to build this into workflows accordingly. I'm not sure if that's applicable here or not, but there are certainly reasons.
Remember, if something can happen it will happen.
M.
@mceleavey - Agreed on the last point - and thanks for the clarification - first example I've seen and now that you mention it I have seen issues like the second with multiple workflow streams and the others being affected by the crash on the first. I guess I usually filter a count in lieu of detour.
yes you can call a macro in a macro. You can also use a summarize tool after a join with no records to get the field names out - there are no records but the columns can be extracted. I made a workflow which unioned a generated row after a zero join and tested to see how many records were there. A count of greater than 1 meant that there were records produced by the Join - and a count of 1 meant the join was empty. If records were in the join I subsequently dropped that record.
That is another way to avoid your current situation.