ALTERYX INSPIRE | Join us this May for for a multi-day virtual analytics + data science experience like no other! Register Now
The Alteryx Community has implemented a new single sign-on experience. If you are having issues with your account, please review the FAQs.

Alteryx Designer Discussions

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

ouput file only if there are records

Jay45
6 - Meteoroid

Hi all,

 

I'm using output csv file to provide the data steward with a quick view on any missing mappings etc... So in the flow I have a branch with conditionals and aggregators to identify erroneous/missing values, then output that to csv on a designated place. The data steward reviews these files and knows what to do.

 

However, the csv is generated even when there are no records. Is there a way to prevent creating the empty csv ?

 

Thanks!

 

kind regards

Jay

MarqueeCrew
19 - Altair
19 - Altair

Hey @Jay45,

 

How about this:

  1. Use a FORMULA to create a "filename" field.
    if IsNull([Required Data Element]) THEN '' ELSE 'FileName.csv' Endif
    if a required field is NULL, then put blank in filename otherwise use your filename (could be a constant).
  2. Output using "Take File/Table Name" and remove the field from your output

If the name is blank, Alteryx won't output.

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.
Claje
14 - Magnetar

I just wanted to add on a little more to @MarqueeCrew's answer.

 

If you set up a formula with a filename, and modify your output data tool to "Take file/Table name from field", then if there are no records passed through, alteryx will not create any files.  That should skip the need for a "required data element", based on your use case.

Basically, I think you could modify step 1 of the prior answer to a Formula of

'FileName.csv'

based on your example

Jay45
6 - Meteoroid

Marked as solution because it was slightly more accurate than MarqueeCrew's answer.

 

I wish this behaviour of NULL filename was better documented...

 

But thanks to both!

Labels