Alteryx Designer Desktop Discussions

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

Don't Output if No Records

kheuer
8 - Asteroid

Hello,

 

I have a situation where I will run a daily process and expect there to be records on some days, but not on others. If there are records, I would like to overwrite the existing the data source. If there are no records, I do not want to overwrite the existing data source. I tried filters and conditional statements but under any circumstance my existing data source will be overwritten with blank rather than not overwritten at all. 

 

Any ideas?

5 REPLIES 5
fmvizcaino
17 - Castor
17 - Castor

Hi @kheuer ,

 

Attached is an example showing how to achieve what you want.

I'm using a block until done to guarantee the test will be done before the output data tool, so I can test the number of rows before it. The idea is to give an error if there is no data going to your output.

 

Let me know if that works for you.

Best,

Fernando Vizcaino

JoeS
Alteryx
Alteryx

Hi @kheuer 

 

You will need to utilise the Summarize, Block Until Done and a Test tool.

 

I have built a quick workflow as an example:

 

2019-12-27_15-15-17.png

 

You can ignore the filter, that's just to make it so that I have 0 records coming into the summarize tool.

 

I then look to check that there is 1 record going into the test tool (that record will contain the count of records).

 

Then I have the "Cancel Running Workflow on Error" checked, so the test tool errors before the Ouput tool runs.

 

2019-12-27_15-16-40.png

jrgo
14 - Magnetar

@kheuer 

 

Here's an option that would not rely on the workflow generating an error to stop the workflows execution. This process would ALWAYS overwrite your file, but it would now contain logic that would determine whether the data used to overwrite the file with is NEW data or keep the EXISTING data.

 

The process takes a record count of what the workflow generates and then appends it to the existing data. The filter then determine if the old/existing data should be passed through or not based on if there were new records.

 

The expression in the Filter tool is simply:

[count] = 0

 

jrgo_0-1577464078006.png

 

Hope this helps!

Jimmy
Teknion Data Solutions

Greenlama254
8 - Asteroid

Hi @JoeS 

I am trying to find a way to attain a similar thing, but then for a pdf output; generate no pdf file if there are no records.

 

I already found another solution for the issue when it the output file is in excel. In those cases I use an If function to change the filepath into a valid filepath when the number of records is higher than 0. In any other case (zero records) an invalid filepath is used and the file cannot be output.

This solution however cannot be used in case of a PDF output file because the render tool does not offer the possibility to change the filepath.

 

I have looked at your solution but I have trouble understanding it to be honest. 
Because in your flow only the summarize tool feeds the block until done tool and after that the output file, but the actual data is not in there anymore because of the summarize tool. 

 

How does the data end up in the output tool if there are indeed records?

 

Thanks in advance

Roger

JoeS
Alteryx
Alteryx

@Greenlama254 wrote:

Hi @JoeS 

I am trying to find a way to attain a similar thing, but then for a pdf output; generate no pdf file if there are no records.

 

I already found another solution for the issue when it the output file is in excel. In those cases I use an If function to change the filepath into a valid filepath when the number of records is higher than 0. In any other case (zero records) an invalid filepath is used and the file cannot be output.

This solution however cannot be used in case of a PDF output file because the render tool does not offer the possibility to change the filepath.

 

I have looked at your solution but I have trouble understanding it to be honest. 
Because in your flow only the summarize tool feeds the block until done tool and after that the output file, but the actual data is not in there anymore because of the summarize tool. 

 

How does the data end up in the output tool if there are indeed records?

 

Thanks in advance

Roger


Hi Roger,

 

Yeah that's an oversight on my part the summarise should be after the block until done.

 

However, if you are on the latest version of Alteryx - the control containers are a much better way of solving this problem :)

Labels