Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

Passing Fields to Macro Input Tool

ricoo
8 - Asteroid

Hi All,

 

I’ve created some Alteryx macros before, but it just confuses me because sometimes when I pass only one field onto a macro with only one input in it. It will output all the fields from the source tool.

In below screenshot, there are 7 fields with the first one being the “Product Code”

 

PassFieldstoMacroInput2.png

 

I’ve setup the macro input tool to accept one field only named “Field”

PassFieldstoMacroInput1.png

PassFieldstoMacroInput8.png

Now when I try to see how the data looks like by just connecting a Macro Output tool directly from the Macro Input, it shows all the fields from the source tool. But it renames the first field to “Field” instead of “Product Code”. I understand the renaming of the first field, but what I don’t understand is that why does it displays all the fields even if only one field is being passed.

PassFieldstoMacroInput3.png

PassFieldstoMacroInput4.png



In addition, even though the other fields are being passed, only one column is being detected from the    connected tools. In this case, the Select tool that is being connected to the Macro Input detects the “Field” that is being setup inside the Macro input, but not the other columns.

PassFieldstoMacroInput5.png

 

 

 Also, the Formula tool can’t detect the other fields.

PassFieldstoMacroInput6.png

Why does Alteryx behave like this?

 

Also, is there a way that I could access the other fields from the Select, Formula, or other tools like Filter, etc.?

8 REPLIES 8
PangHC
13 - Pulsar

the interface just means to map the field if field name is different, you can try to add more field in macro input.

 

for my experience, before develop macro better to ensure input from data stream structure is same with macro input. 

so mostly I will copy some sample data from data stream to macro input as start and develop as normal workflow. 

 

hope it clarify.

 

Amol_Telore
11 - Bolide

Hey @ricoo 

 

In Macro Input connector, we specify the incoming data structure.
From the description you have given, it seems like Macro input tool has only one field i.e., "Field1".
That is why in the formula (Within macro), you only see one column "Field1". Cause in incoming metadata has only one field.

 

Answering your first question,
Macro Input tool has one property, map incoming field.
When this option is selected, you will get a drop-down button to map the incoming data (from parent workflow) with whatever columns you have specified in Macro Input tool.
If you have five columns specified in macro input, you will get 5 drop down and vice versa.
In your case, you have one field thus you are getting only one drop down.

Having this drop down, does not mean that it will remove other columns (from the dataset coming from parent workflow) that are not selected in drop down.
It means that it will simply map "Product Code" to "Field1" within Macro and will also read additional columns from incoming dataset if any.

 

@MeganBowers has created a detailed blog on Macro and Analytic Applications. You may find this helpful. 

 

Apps and Macros Guide - Alteryx Community

 

Regards,

Amol Telore

ricoo
8 - Asteroid

Hi @PangHC  @Amol_Telore 

Yes you're right. I’ve done macros before wherein I have to setup specifically multiple fields in the Macro Input tool to accept incoming data with the same number/structure of fields. But when I found out that, a Macro Input tool can also pass all the fields to a Macro Output tool even if only one field has been specified on dropdown,  I intentionally setup only one field in the Macro Input tool. My goal is to dynamically read all the fields being passed, and check if the values within the passed fields are NULL. 

PangHC
13 - Pulsar

@ricooto check empty fields

 

you may use transpose + summary.
Screenshot 2023-09-07 161950.png

ricoo
8 - Asteroid

@PangHC I will try. Thanks!

ricoo
8 - Asteroid

Hi @PangHC 

Sorry, but my problem is about looping through all fields that are being passed on the Macro Input tool. That's why I used the multi-field formula to determine if a field is NULL. If it's null then I'm going to concatenate all of the NULL fields into one column. This problem seems to be very complicated. I guess I should stick to setting up the Macro Input with the specific columns that I need instead of having it to accept dynamically.

PangHC
13 - Pulsar

@ricoo why you concatenate the empty field? i think you want to know which field is blank. 

 

here the example workflow to remove empty field. second browse tool to review the empty field. 

Screenshot 2023-09-11 101207.png

 

ricoo
8 - Asteroid

Hi @PangHC I now have discarded this approach. It was just too complicated. I've decided to concatenate all fields before passing it into a macro though by using the approach mentioned in this topic:  

https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/Concatenate-All-Fields-Dynamic...

It's still a work in progress, but I'll have to continue using this approach moving forward.

Labels
Top Solution Authors