Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Render Report only if records

JGHOLLAND
7 - Meteor

Hello, I've seen a few questions about how to only generate an output file if there are records.  I have a similar problem but those answers aren't applying to my issue.  I only want to render a report or generate a table if I have records present.  Eventually I'll be sending an email out, so I don't want the email to go out with a blank report.  Only if there are records in it... any help would be much appreciated.  Thank you!

17 REPLIES 17
OTrieger
12 - Quasar

Hello @JGHOLLAND 

You can use the Detour tool to get that done.

Put a Count Tool and then a condition if  count equal zero then 1 else 0 or something similar.

Then what you will need to do in a formula tool, update the XML attribute of the XML code and then connect it to a Batch Macro. Your Control Tool will be connected to a Detour Tool, one end will be connected to the email and then other end can be connected to a message tool getting a message that no data available. In that manager based on the data will flow to the email tool or to the message tool.

Another way, with the same concept will be to do the same but with a Radio Button Tool XML attribute. In the batch macro the control tool will be connected to the Radio Button Tool which will be connected to Condition tool and 2 Action tools to a Container that will be enable or disable based on the data. Obviously the email tool will be in that container.

Any of the above should work.

JGHOLLAND
7 - Meteor

Thank you so much for the help- is there any way you could please post an example of this solution?  Thanks!

JGHOLLAND
7 - Meteor

This is how I was attempting to do this.... I also click "Cancel Running Workflow on Error" - having 0 records should make this give an error.  It still seems to render the PDF (albeit blank) though... 

JGHOLLAND
7 - Meteor

Could you please post an example of what you describe?  

OTrieger
12 - Quasar

Ok, this is an example, very similar.
The first thing is to see the XML code for the tool:
Detour.PNG

OTrieger
12 - Quasar

Now in your case you will need to set a condition True false based on the Count tool and then with a IF formula you can set the Detour variable to be True or False

JGHOLLAND
7 - Meteor

I'll be honest, I'm not tracking this exactly..  I understand if you can't b/c you're busy, but if you could edit the .yxmd file I put above, I'd appreciate it.  I'm not following the screen shots and how everything is connected in your solution.

OTrieger
12 - Quasar

Here is a snippet with the sequence, before the batch macro and in the batch macro. If you still find it hard go and do the training on macros and batch macros to fully understand the concept of it and how it works. I can guide you however you need to do it and that's requires understanding, something that I cannot do for you. I hope that the attached snippet will give you more mass on how it should be.

Macro.PNG

DataNath
17 - Castor
17 - Castor

Hey @JGHOLLAND, are you on a recent version of Designer (2023.1+)? If so, Control Containers will do exactly what you're after, as they're designed to orchestrate sections of a workflow sequentially/conditionally. I wrote a blog on their functionality - you're looking for the 'Running parts of your workflow conditionally' section: https://www.databasyx.com/blogs/using-control-containers-in-alteryx-designer

Labels