Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Using a macro with looping to prioritize data.

pedropesca
5 - Atom

Hi everyone!

I have a table like this one below:figure 1figure 1

 

What I need as result is a rank of the stores by the largest Accumulated Money (which is the sum of the column “money” grouped by store).

As you can see, some people are attended by more than one store, therefore I need to perform a loop to sort the stores by the Accumulated Money, select the first one and copy its value to the rank sheet, then eliminate the “already attended persons” from the others stores, and sort again the remaining stores. And keep repeating this process until all stores are ranked.

figure 2figure 2

 

 

This is the workflow I’ve created, and I don’t know how to link the “False” values back to the beginning to repeat the process. I’ve watched the Macro’s videos and searched through the community, but I couldn’t make it work properly.

Can someone, please, help me with this matter?

Thank you!

2 REPLIES 2
Dynamomo
11 - Bolide

@pedropesca,

I can't believe how close you were to figuring this out.  you had all the hard work done!

the only step you missed was to expose the Interface Designer window (View-> Interface Designer) and then configure it with the Iteration Input (v Input) and the Iteration Output (the macro output that loops around).

Here is a workflow export package that includes a workflow with your macro in it, with the iteration part setup.

 

Capture.JPG

pedropesca
5 - Atom

@Dynamomo,

 

First of all, thank you for your response, and then, apologies for my delay.

 

When I ran the workflow, the macro did it’s loop correctly, but the result came out wrong. So I’ve been trying to fix the error but couldn’t find it.

 

I’ve made a bigger and more accurate sample to show the problem here. When I run the workflow, this is what should be the outcome:

Real resultReal result

… And this is what Alteryx is giving me:

Alteryx resultAlteryx result

As you can notice, Stores 15 and 16 are presenting their full accumulated money, like the persons that are already being attended by the previous stores never been removed from it.

 

Can you, or anybody else, help me?

 

Kind regards, Pedro.

Labels
Top Solution Authors