Alteryx Designer Desktop Discussions

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

looping over mcaro's

Mikis
8 - Asteroid

Hello everyone,

 

I've built a work a workflow that converts my data into 3 groups (high, medium & low).

The flow is attached with some representative data

The problem is that I would need to run this workflow a variable amount of times, so I believe I need to convert my macro to a batch macro, but I'm not sure how.

my original data looks like this (but way more records and way more marketshares)

respondentmarketshare_1marketshare_2marketshare_3
152015
2152510
320105
452515
515202

 

my macro tries to determine if these values are low, medium or high.

The ideal final outcome would be this (currently it spits out 1/2/3 which I'll convert to L/M/H)

respondentmarketshare_1marketshare_2marketshare_3
1LMH
2MHM
3HLL
4LHH
5MML

 

This works fine for one iteration (combination of respondentID & share) , but I want to loop over each combination.

My first call to the macro would be

respondentmarketshare_1
15
215
320
45
515

 

and then

respondentmarketshare_2
120
225
310
425
520

 

and so on.

 

Could anyone please help in setting this up?

 

Thanks in advance!

Mikis

4 REPLIES 4
BenMoss
ACE Emeritus
ACE Emeritus

You can convert this into a batch macro relatively simply, check out this post which gives an introduction...

 

https://www.youtube.com/watch?v=YIAbQGQ_Hkg

 

I've constructed an example using your data.

 

See attached.

Ben

Mikis
8 - Asteroid

@BenMoss

 

I couldn't open your package since you used a newer version, so I updated my alteryx.

Sadly, this started an error message an Unhandled Exception occurred. A previous action may not have completed successfully

And now I can't open anything anymore :(

Just to explain why I haven't set your answer as solution yet

 

I had seen the video, but it assumed there was like one row and one field as the input, and it loops over the rows.

The difficulty to me was

1) establishing that I always wanted to send a fixed field (responseID) and one variable field (marketshare)

2) how I can specify that I want to loop over a whole field and not record per record

 

Regards,

Mikis

Mikis
8 - Asteroid

@BenMoss

 

I managed to open it. Yay.

However, if I'm not mistaken, the macro duplicates records?

I have respID 1 for which I want a group per marketshare.

In the screenshot below, you see that respondent 1 appears in record 1, 2 & 3 and then again in 80, 81 and 82.

Normally the macro should send back 1 HML_coding per respondentID & marketshare.

 

 Capture.PNG

Mikis
8 - Asteroid

I found it, the groupBy was only configured for the control field, not for the input92 field :)

Took me some time to figure it out, but I learned quite a bit about batch macro's in the process, thanks!

group by.PNG

Labels