Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

If statement else abort flow

Benjamin_TheCoder
6 - Meteoroid

Dear community,

 

Is there a way to abort the flow if the IF-statements aren't true?

 

Like:

IF statement THEN X

ELSEIF statement THEN Y

ELSE abort (or error)

ENDIF

 

Thank you in advance!

5 REPLIES 5
afv2688
16 - Nebula
16 - Nebula

Hello @Benjamin_TheCoder ,

 

You can do this by setting up a message tool. In this example I have put a basic condition that the lines have to follow, if not it will pop up the message but that wont stop the workflow (It will if it is an app).

 

To stop the workflow you would need to edit the runtime configuration tab by enabling stopping the workflow on error:

 

Untitled.png

 

Regards

Benjamin_TheCoder
6 - Meteoroid

Thank you @afv2688 for the answer.

 

That is the solution I currently have, which works great. But I was looking for an error message in the Formula-tool itself, to make my flow more dense.

JokeFun
8 - Asteroid

What options we could have if I just need to abort one flow within the entire workflow process when there's zero records coming through.

For example,

Flow 1: A->B->C

Flow 2: D->E->F

C and F are combined to further down steps. Now the case I have is errors come up in flow 2 when there's no data coming through especially at tools like Filter, Join etc. because the filter key field/join fields are missing. So I just want to stop Flow 2 at a certain point when it's confirmed no data coming through, but Flow 1 and the combined flow will continue.

Benjamin_TheCoder
6 - Meteoroid

Hi @JokeFun ,

 

If I am correct, your question is: how can I stop a workflow if the value needed further down the workflow for it to run without error isn't in the data?

 

My answer is: that I don't know how to make that work because the tools in the workflow still require their input. 

 

However, I might have a workaround that can help you. I solve this problem by adding the required values with a Text Input combined with a join. In the following image, you see two XML-Parse-tools. The first one outputs the field "openingBalance_OuterXML" if the value "openingBalance" is found. The second XML-Parse-Tool requires the field "openingBalance_OuterXML" to run. This field is not in the data because the workflow didn't find it in the first XML-Parse-tool.

BenjaminConeyMinds_0-1654972818170.png

To not let the workflow error so the rest of the workflow branches can still run, I have added the field manually with an Input-tool. It looks like this:

BenjaminConeyMinds_1-1654973207934.png

Because the values of the field are empty, it won't alter my data in a harmful way. Since further down the workflow, other tools also depend on the output of XML-Parse two; I need to repeat this workaround a few times.

 

I hope this helps. Let me know if I didn't fully answer your question.

 

 

 

JokeFun
8 - Asteroid

Hi @Benjamin_TheCoder,

 

Thanks for your creative idea. It seems to be able to address my problem. Thank you! I will try this and update here if any further question.

 

 

Labels