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!
Solved! Go to Solution.
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.
Thank you so much for the help- is there any way you could please post an example of this solution? Thanks!
Could you please post an example of what you describe?
Ok, this is an example, very similar.
The first thing is to see the XML code for the tool:
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
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.
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.
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