Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

How to divert a workstream when no data filters to one end

earth2joy
7 - Meteor
I have a workflow that contains many filters and little substreams that handle special situations. When no data exists toward a particular substream, I'd like to skip it. How do I do that?
7 REPLIES 7
mceleavey
17 - Castor
17 - Castor

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.



Bulien

earth2joy
7 - Meteor
Hi M. I didn't expect such a quick response! Lucky me! Yet, I am still in the twilight zone here. Which part of the workflow needs to be in a macro? Would that be everything prior to the detour, or just the subset that determines the count of records? I would share a generalized sample flow, but the security in this position prevents me from copying anything internal to an outside source. I can't even send an email outside the organization. Basically, two inputs are filtered, then joined. If the count of joined records is zero, then a section of the workstream that includes xml parsing, transposing, and another join, should be skipped. Also, I've never created a macro, so not clear on that either. Thanks so much! Joy
apathetichell
19 - Altair

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.

mceleavey
17 - Castor
17 - Castor

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.



Bulien

apathetichell
19 - Altair

@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.

earth2joy
7 - Meteor
Yes, that's exactly it. The data from two inputs is inconsistent and needs to be compared. Basically like this: Input A --> Records without Condition ----> bypass intermediate analysis Input A> Records with Condition ------> XML Parse + Transpose + Join on key fields to Input B---->Output separately Input B> Records with Condition ------> XML Parse + Transpose + Join on key fields to Input A----| Re-join to main flow Input B --> Records without Condition ----> bypass intermediate analysis Both A&B need the condition in at least one record each for the join to be necessary. I've got it to the point that I can determine if inputs A&B have at least one common key record, but I am stuck at how to handle zero common records and skipping that middle part with the XML Parse & Transpose. As mentioned before, I'm not familiar with how or where to create the macro section. Also, this entire workflow will ultimately become a macro app. So, can a macro contain a macro? Thanks, everyone, for your help! Joy
apathetichell
19 - Altair

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.

Labels
Top Solution Authors