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)
respondent | marketshare_1 | marketshare_2 | marketshare_3 |
1 | 5 | 20 | 15 |
2 | 15 | 25 | 10 |
3 | 20 | 10 | 5 |
4 | 5 | 25 | 15 |
5 | 15 | 20 | 2 |
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)
respondent | marketshare_1 | marketshare_2 | marketshare_3 |
1 | L | M | H |
2 | M | H | M |
3 | H | L | L |
4 | L | H | H |
5 | M | M | L |
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
respondent | marketshare_1 |
1 | 5 |
2 | 15 |
3 | 20 |
4 | 5 |
5 | 15 |
and then
respondent | marketshare_2 |
1 | 20 |
2 | 25 |
3 | 10 |
4 | 25 |
5 | 20 |
and so on.
Could anyone please help in setting this up?
Thanks in advance!
Mikis
Solved! Go to Solution.
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
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
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.
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!