Alteryx Designer Discussions

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

Get all files to write regardless of data prior to end of Alteryx flow

6 - Meteoroid

Hi All -


Having an issue outputting data to excel sheets. I'm reading an existing template (has calculations and formatting) into the working directory where I then output data to that template. 


Sometimes, the output data tool will end up having no data to that sheet as a result of filtering. In these cases, it seems like Alteryx waits until the end of the flow to output the 0KB sheets regardless of where they fall in the flow and any blocking/waiting that I do.


This is an issue because the empty output acts as a "format" and leaves only headers in the sheet, and at the end of the flow I am using run command to move files around dependent on whether the user/creator wants the file to download from gallery or sent in an e-mail. If the empty output waits until the end, the run command moves the file and/or an e-mail is sent while the sheet isn't formatted, then a small file is created in the place I just moved one from when it does finally run.


I can't really use an event either, as I'm writing the part that moves files as a macro (that includes an e-mail batch macro that allows different numbers of attachments) to be used in multiple flows.


I'd really like a way to force all the files, even if only containing headers, to complete writing before my end process without having to add a tool to every output if someone knows a way to do that.



15 - Aurora

Hi @hamdonut 


I tried and confirmed it as you said. I knew the behavior at this time.
In this case, you can use container tool.


Firstly you put Output Data tool into the container.
When the record is zero, you make the workflow that disable the container to not write the zero data. So the Data Output tool will not work.

You need to use batch macro in this case.


Sample macro :


The workflow that calls the macro : 



Please check the uploaded workflow.



6 - Meteoroid

Hey @AkimasaKajitani - 


Thanks for spending time with this - in my case I actually did want the 0KB files to write prior to the command tools running, and I was trying to keep things from being complex by using batch macros, or wrapping outputs in macros.


I ended trying to think simply and coming up with the attached macro solution that just adds in a blank row to the end of the any data frame, and in the case of no data output just adds a blank row. If the end user is trying to use my other solution, they just need to add in these macros prior to outputs. This avoids the 0KB issue.


I'm sure it would be easy to add in some logic that bypasses the row add if there's data in the incoming stream, but for my purposes it doesn't really matter.

15 - Aurora

Hi @hamdonut 


I think your solution is very simple way and it will work well. 

I was overcomplicating things.


6 - Meteoroid

I was definitely overcomplicating things on my end as well 😊 @AkimasaKajitani