Alteryx Designer Desktop Discussions

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

Detour or ignore section of workflow if condition is not met and w/o throwing error?

hellyars
13 - Pulsar

See image of workflow snippet below.   Can't really attach workflow and can't really fake it since it needs XML to parse.

 

#A (first parse tool)  Parse Tool.  It will generate NEW_FIELD_OuterXML -- if it is present (it may not always be present).  

#B  (the filter tool immediately after the parse tool -- and with the error badge in the image) Filter Tool checks to see if NEW_FIELD_OuterXML is present; if True then it sends the record(s) to be parsed.

  •  
  • PROBLEM #1.  If NEW_FIELD_OuterXML is NOT present (which may occur) the #2 Filter Tool throws and Error (impacting the entire workflow).
  • PROBLEM #2  If New_FIELD_OuterXML is NOT present then every subsequent Parse Tool will throw and Error (since the fields to be generated by parsing NEW_FIELD_OuterXML will also not be present for later stages of this section).

 

What I have tried so far:

  1. I tried the Count Records approach.  It does not work, because NEW_FIELD_OuterXML is still not present.
  2. A brute force approach using half a dozen or so Ensure Fields tool works, but there has to be something easier??
  3. I tried adding a Filter Tool before #A Parse Tool to filter the records hoping it would ignore this section, but #B Filter still throws the error (even with 0 records).

 

QUESTION:  How can you halt, detour, ignore a section of a workflow if a field is not present  -- and do so without throwing errors?

 

WORKFLOW IMAGE

 

Screenshot 2023-08-14 204901.png

 

Brute Force w/ Ensure Fields (6 more not visible)

 

Screenshot 2023-08-14 210607.png

 

 

2 REPLIES 2
CharlieS
17 - Castor
17 - Castor

Hey @hellyars 

 

There are Detour tools that are great for only passing data to tools of the active route (and the other tools won't error if they're missing a field). The detour control comes from a checkbox on the tool UI. However, since the decision to detour or not is coming from the data stream, you'll need to take a few more step to make this happen.

 

This is called a "Dynamic Detour" (when the decision is based on the data stream). My preferred method is to use a batch macro. Insert the detour tools in your workflow, then take that section and save it as a batch macro with the Control Parameter updating the detour. Then when you re-insert that into your workflow, dynamically determine if you need to detour and use that to update the Control Parameter. 

 

Here's another good link to check out on dynamic workflows:
https://www.altertricks.com/expert/building-dynamic-workflows-with-detour-tools-or-updating-xml/

 

 

Jay-RDC
8 - Asteroid

Will this work if used in Alteryx Server and not Designer. I tried using Message Tool, Error Tool, Test Tool and all three doesn't work on the server. An error still shows even when the condition to trigger the error is not met.

Labels