Start Free Trial

Alteryx Designer Desktop Discussions

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

Conditional Detour in a Batch Macro

Raphael_Des
5 - Atom

Hi,

I am designing a batch macro to aggregate several CSV files into one single Database.

However my inputs don't have a set number of columns, as some sub identifier can vary from 5 to 8 identifiers each stored in different columns.

I am trying to create a conditional detour to check if the columns 5, 6, 7, 8 are already in the input, and if not add a blank column.

For that I have extracted the Field information and compared it to a list containing the field name "Column5, Column 6, Column 7, Column 8", which then create a flag (0/1) for the detour.

 

However it seems that my drop down tool is not sending information to my condition tool.

Would anybody have some advice on how to handle this issue, rather by correcting something on my workflow or a new approach.

 

Many thanksAlteryx Help Screenshot.PNG

 

4 REPLIES 4
jrgo
14 - Magnetar

Hi @Raphael_Des 

 

If the flag you're creating is inside the macro itself, that wont work because Interface tools execute before the workflow run.

 

And in case you were trying to make it work this way, Interface tools can't be used as normal tools, meaning, if you have the YXMC file open and hit the run button, all the interface tools are inactive.

 

If all you're trying to do is add columns that might be missing, you can use a Text Input tool and create an empty table with the columns that your expecting to see and UNION with your main data stream (CSV file), like this...

jrgo_1-1763592729235.png

 

Hope this helps!

 

-Jimmy

Raphael_Des
5 - Atom

Hi Jimmy,

 

Many thanks for your reply, however I have tried this initially but because of of the batch macro treating several files with different number of columns, the macro failed for some of this files, linked to old name column name being stored and considered missing, depending on from which side of the union they were coming from.

 

So basically I can't use additional interface tool aside of the one used to set the batch macro up? Would a nested macro work, ie passing both the condition and the table in another macro and creating the detour there?

 

 

Raphael_Des
5 - Atom

Hi,

 

I figure out a way to achieve the objective by transposing the field in rows and making the adjustment there. It's not very clean and can probably be improved to make it scalable but good enough for my usecase.

 

Many thanks for your help

Raphael_Des_0-1763638438178.png

 

jrgo
14 - Magnetar

You can also adjust the Output Mode in the Interface Designer to avoid output column differences between each batch iteration to this.

jrgo_0-1763647765350.png

 

Labels
Top Solution Authors