Alteryx Designer Desktop Discussions

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

How to Still Output a File, Even If a Query Returns Zero Results

RonGatmaitan
8 - Asteroid

Hello,

 

Pretty self-explanatory, based on the title.

 

I have a workflow that queries from a database (In-Database tool), processes the data, and then uploads it via Amazon S3 Upload tool. The client expects a file, whether there is data processed or not. Problem is, Alteryx's default is usually not to output anything, when there is no data. Is there a simple way around this?

 

Thank you!

6 REPLIES 6
Felipe_Ribeir0
16 - Nebula

Hi @RonGatmaitan 

 

You could add a null data row with text input tool+union tool to the dataset. I think that it would solve your issue.

Felipe_Ribeir0_0-1668426227131.png

Felipe_Ribeir0_1-1668426269481.png

 

 

IraWatt
17 - Castor
17 - Castor

Hey @RonGatmaitan,

Interesting question, when I try this even with zero records a file is still wrote to S3:

IraWatt_0-1668426577579.png

 

RonGatmaitan
8 - Asteroid

Hi @Felipe_Ribeir0, will look into this. :)

Hi @IraWatt, even if it said 0 records were written? Did you check the AWS Bucket if I file was written?

RonGatmaitan
8 - Asteroid

Hi @Felipe_Ribeir0, not sure if I can add a null data row. Should only be uploading the headers. Is there an if-then tool?

IraWatt
17 - Castor
17 - Castor

@RonGatmaitan yeah you can see the S3 input tool below. My DB just outputted one header with no records, and it wrote to S3. When i input the data, I just get the header with no records. 

RonGatmaitan
8 - Asteroid

Hi @IraWatt

 

Oh, yes, it did work!

Here where, I realized, the problem was.

RonGatmaitan_0-1668494376276.png

The parameter being passed as filename to the macro which contains the AWS Upload is also dependent on the script. The script doesn't return a value, the workflow doesn't pass a parameter.

 

Here's what I did, instead.

RonGatmaitan_1-1668494584204.png

This way, even if the query doesn't return a value, the parameter still generates a file name.

 

Thank you very much for your valuable insight! Accepting your answer as solution.

Labels