Upgrading Server to version 22.1? We’ve enabled the faster AMP engine by default. Read about how these system settings changes might affect you.

2022-05-24 Updates: Login: If you are facing issues with logging in, please try clearing all your cookies or trying another browser. We have a fix being deployed on the evening of 5/25. Email: If you're not seeing emails be delivered from the Community, please check your spam and mark the Community emails as not junk. Thank you for your patience.

Alteryx Designer Discussions

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

How to not create output when no records

olivia_paquot
8 - Asteroid

Hi !

 

I have a workflow with several outputs, and several of these outputs can be empty (no records).

 

How I can stop the output(s) where I have no record, and allowing at the same time the creation of the other outputs where there is at least one record ?

 

Thanks a lot !

 

Kind regards,

Olivia

12 REPLIES 12
MarqueeCrew
19 - Altair
19 - Altair

@olivia_paquot,

 

That was an interesting question to solve.  First, I want to point you to an idea for a programmatic detour.  This would solve the problem in a straight-forward way:

 

 https://community.alteryx.com/t5/Alteryx-Product-Ideas/Programmatic-Detour/idi-p/12763

 

Now for the answer to your post....

 

Step #1: Create a field called NULL and fill it with a formula NULL()

Screen Shot 2017-02-14 at 8.04.51 AM.png

Step #2: Include NULL as part of the file/table name in the output configuration.  Uncheck the field (not to keep it in output).

Screen Shot 2017-02-14 at 8.09.11 AM.png

 

This will prevent the output file from being created (No error message is created) when 0 records are present and will create a normal output file when data is present.

 

Happy Valentine's Day,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
olivia_paquot
8 - Asteroid

Thanks a lot, it works !

 

Have a nice day.

AI
7 - Meteor

Hi Mark,

 

The solution worked. Thanks. I have a follow-up question on this. I have a workflow that I execute prior to a data load for quality check and within this workflow I write to a single output file say "QC_Report.xlsx" but several tabs and I used the option as suggestion by you. I have the output option as "Overwrite Sheet (Drop)". This works. However, if the output file had data written to a tab "Missing Definitions" from a prior workflow run and during the current load there are no records to be written, then the empty tab will remain in the output file.

 

If the file name does not change with each workflow run but I want no empty tabs, how would i go about it? If I don't want to change the file name in every output tool, how can I generate a new output file using a formula tool and still be able to use the new file name along with the "Null" option for the suffix?

 

Thanks,

Aruna

rpenatez_dup_538
5 - Atom

This is awesome! Great trick!

nisarg205
7 - Meteor

stubartmess
6 - Meteoroid

Hi Mark,

 

I have the exact opposite problem, where I want to write a file with no lines of data but am taking the file name from the data. I can create a null row and append my file name to it, but this results in a written file with one (albeit empty) row.

 

Do you know a way to write a blank, dynamically-named file?

 

Thanks,

Stuart

carl_steinhilber
8 - Asteroid

I think this is my exact problem, too, Stuart.

 

I have a series of datasets that need to be cleaned and written to files. Each file MUST exist for validation purposes. But because of some nuances with the platform that imports the data following the cleaning, empty datasets need to be output as empty/blank (dynamically-named) files or, in certain circumstances, files with only a header row.

 

But I can't get Alteryx to write a file if the dataset is empty.

josephrosas
5 - Atom

Worked like a charm! Thank you!

Robin_MasonBreese
6 - Meteoroid

Excuse my ignorance but where do we create the field?

Labels