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

Iterative macro

amrutkasyap
7 - Meteor

Hello,

 

I read data from an excel file whose file structure is as below. It has GroupId, company_name and lot of other columns. The logic is to find unique company names, get all groupid's and apply certain process.  The processes is same for different companies. 1 company can have multiple group id's. So the workflow has to iterate through distinct companies. 

 

For e.g.

for Comp_1 --> 1,2,5 [ group id's ]

Comp_2 --> 3,7,8 [ group id's ]

 

Does this need a iterative macro if so are there any examples,

 

GroupIdCompany_NameCol3Col4
1Comp_1asasasas
2Comp_1asdasdasdasd
3Comp_2asdioasasd
4Comp_3askdjasasdasd
5Comp_1asdasasas
6Comp_4sdasdasdas
7Comp_2asdasasda
8Comp_2asdasasdasd

 

I tried writing a macro to update the Company Name but not seem to be working. Any help is appreciated.

 

THanks

 

amrutkasyap_0-1572843490313.png

 

4 REPLIES 4
Dazzerman
11 - Bolide

Sometimes an Iterative macro is required to solve a problem like this, but other times you can do it with a Batch macro as you have done.

 

Have you configured the Macro tool in your workflow that calls your macro to Group By your Company_Name field?  This may be what you're missing.

Dazzerman
11 - Bolide

For example.  Once you have configured your Control Parameter setting in the Questions Tab, you need to click on the Group By tab and configure it accordingly.

 

I hope this helps.

 

Macro_config.jpg

danilang
19 - Altair
19 - Altair

Hi @amrutkasyap 

 

Macros add an extra level of complexity to any process and before you build one, try and see if the existing process can be made to apply to all companies at once.  You can try adding the company name as a group by field in Sort, Sample, Multirow, Transpose, Crosstab and other tools.  For any joins, add the company name as an additional join field.

 

The simple sample below calculates the percentage of total sales for each company that each group generates.

 

w.png

 

If, after this analysis, you feel that you still require a macro, then remember that the action tools only work when the macro is called by an external workflow.  Inside the macro, the filter tool will always use the value that is set set in configuration window.

 

Dan

amrutkasyap
7 - Meteor

Thanks this approach worked..

Labels