Important Community update: The process for changing your account details was updated on June 25th. Learn how this impacts your Community experience and the actions we suggest you take to secure your account here.

Alteryx Designer Desktop Discussions

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

Interative macro for sample selection

Olexandra
5 - Atom

Hi!

 

I try to use iterative macro to perform sample selection. I am making something like this for the first time so maybe solution is simple)

 

I have breakdown of transactions. I left only columns which will be used: counterparties name (here just numbers), date of transaction (month), record ID.

 

I need 15 items with no counterparty to be repeated twice and at least 1 transaction within each month.

 

Details of logic of the worklow is inside the file. Overall the point is that in each iteration 1 record should be chosen within remaining population - list of transactions with counterparties or months not used before. And I would expect that macro would stop on the 15th iteration but it does not. It goes to the maximum of 100 iterations and does not return any transaction at all.

 

I do not understand whether there is a problem in a workflow or any problem with macro itself but it does not work the way it should when I put it in my workflow.

 

I would much appreciate your help.

 

Thank you!

 

5 REPLIES 5
Qiu
21 - Polaris
21 - Polaris

@Olexandra 
This is a very interesting one.

From what I can see, your iteration number should much larger.

 

I took a different approach that get all the collection of records that meet your requirements, meaning more strict.

Will try by random approch latter

1109-Olexandra.PNG

Raj_Singh1
9 - Comet

Hi, 

 

pic1- I used your macro and made small changes, changes are highlighted in green. 

 

pic2- i made small change to month,(number of items) as number of items sum should be 15. that is we have 9 months so some months will have two entries.

 

pic3- output 15 entries

 

Comm 2.JPGComm 1.JPGComm 3.JPG

Olexandra
5 - Atom

Well, I changed the workflow so many times back and forth that I did not notice even most obvious mistakes like number of items in total are not 15)

 

Thank you for your help!

 

Could you please explain the logic behind adding Test and Test 2 columns in the end of the macro workflow?

Raj_Singh1
9 - Comet

Hi Olexandra,

 

The reason i added test 1 and test 2 is. When  count 15 is achieved, there are still other records continue to go through filter to  loop which you want to stop as soon as condition is met .

 

so when you have 15 count met you add test value to make a join and which joins with unwanted records and flows through join and no values flows through right join. when there 15 count is not achieved, the join is not complete and you want value to loop bu passing through R

Please see pic 1

 

Comm4.JPG

 

 

Olexandra
5 - Atom

I see

Many-many thanks!

Labels