community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Upgrade Alteryx Designer in 10 Steps

Debating whether or not to upgrade to the latest version of Alteryx Designer?

LEARN MORE

Not to execute the WF if the input data set is empty

Asteroid

Hi

 

I am working on a data comparison workflow.

I have a scenario where either the First input data set or the second input data set can be empty.

When this happens, instead of running the entire WF i want to stop the execution and write a log file with info that input is empty.

 

Can this be done ?

 

Thanks

Nidhin

Alteryx Certified Partner
Alteryx Certified Partner
Hi!

This can be achieved with the message tool.

First I would take a count of the number of records in the data stream and then append this value against every line.

Bring a message tool onto the canvas and build a statement which returns true if the count is 0.

You can then write a message which will appear in the results pane and thus the logs too.

You can also change the error type, I think you want the 'error and stop records processing through tool' option.

You can then build your stream off the back of this tool, nd records will only flow through if your statement returns false.

Ben
Asteroid

Hi@BenMoss

 

I tried out the step you provided.

 

PFA the workflow sample.

The data is passing through the message tool.

Can you please have a look.I want to stop the execution before it reach the join if the file is empty

 

Thanks

Nidhin

 

 

Alteryx Certified Partner
Alteryx Certified Partner

Hi @Nidhin; you have not set a condition on the message tool.

 

Firstly, you should use the 'Count Records' tool rather than the summerize tool. The count records tool will always return a value, the summerize tool will not if no data exists.

 

In the message tool you need to choose the option 'Before Rows where Expression is True' and then set the condition [Count] = 0

 

The message expression that you have at the bottom is simply what is written to the logs and should be along the lines of "No data".

 

Ben

Asteroid

Hi @BenMoss 

 

I tried creating the WF following the steps you mentioned.

 

It seems that the message tool does block the records but the headers are passed crossing the join to process in my WF.

 

I basically want to union the join out (LRJ) and do a check afterwards in the WF (I am using the multi field formula tool to force all columns to v_string due to nulls the fields can have different data type.)

 

What i want is if any one of the data set is empty, it should not proceed to the Join tool causing the WF to Fail.

 

Please have a look..

 

Thanks

Nidhin

 

 

Alteryx Certified Partner
Alteryx Certified Partner

Firstly, I cannot run your workflow as the data is pointing at your local machine; in order to create a 'transferable' workflow you need to look at using the 'export workflow' option available under options. This will create a 'zip' file which includes your data.

 

Then we can help you come to the solution you need, though I'm not sure what the problem is. Your workflow will not write data to any output if there are any 'fatal' errors in your workflow (that's my understanding anyway).

 

Ben

 

 

Asteroid

Hi @BenMoss 

 

Please find the WF attached.

 

I have a workaround to log if the files are empty (To write to an output excel).What i need is to STOP/Terminate the WF when there is an empty file.

i have to do some calculation post the Join tool.My expectation was that if no records are passed by message tool then the Join will fail and the WF terminates.But sadly that is not the case.The message tool passes the header row and block the record.Due to this the Join tool will generate output (Left Out/Right Out) and the WF continues to execute.

 

Thanks

Nidhin

Asteroid

Attachment

Hi @Nidhin and @BenMoss,

 

the solution is described here:

https://community.alteryx.com/t5/Alteryx-Knowledge-Base/Stop-workflow-on-a-condition/ta-p/19890

 

The crucial part is

1. click on the canvas and navigate to ‘Runtime’ in the configuration window

2. select tick box ‘Cancel workflow on error’

Since the test tool threw an error before, the global setting will terminate your workflow immediately.

 

Cheers

Mathias

Alteryx Certified Partner
Alteryx Certified Partner

@Nidhin & @MathiasRichter,

 

Inside of the CReW macros there is a Blocking Test macro featured in this video.

 

 

You can use the blocking tool to make sure that there is data by inserting a COUNT ROWS tool (macro) after the input and APPENDING the "source count" to each record.  Then use the blocking test to ERROR when the count = 0.  After the blocking tool, you can put a select tool onto the canvas to remove the count field.  When an error is encountered, you can configure the workflow to quit.

 

You can download the CReW macros here or navigate to chaosreignswithin.com .

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.
Labels