Alteryx Designer Desktop Discussions

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

An Iterative Macro to Calculate the Permutations

Qiu
21 - Polaris
21 - Polaris

Dear All
I would like to ask your help on the iterative macro to calculate the permulations of given numbers.

For example, If I input 3, I would like to result to be as below

PP1P2P3
3123
3132
3213
3231
3312
3321

I watch the interactive lesson for iterative macro again and still get stuck.

Hope you can enlighten me. Thans a lot.

 

3 REPLIES 3
AkimasaKajitani
17 - Castor
17 - Castor

Hi @Qiu 

 

I think there is 3 problem.

 

First problem is the wrong select of the field.

AkimasaKajitani_0-1657286099087.png

 

Second problem is the exit loop condition. The original macro is after the appending. The result contains wrong data which should be disposed.

AkimasaKajitani_1-1657286187704.png

 

Third problem is that you input the field "Field1" which should not be contain. Please insert select tool and delete the Field1.

 

AkimasaKajitani_2-1657286848412.png

 

I attached the fixed version and my workflow which I made from scratch.

Qiu
21 - Polaris
21 - Polaris

@AkimasaKajitani 
Thank you so much for saving my day.

I shoud be more careful.
I am planning to have a weekly challenge idea which involves an iterative macro. Maybe I can include your name for the submission? 😁

ありがとうございます!

AkimasaKajitani
17 - Castor
17 - Castor

Hi @Qiu 

 

You are welcome!

Debugging the Iterative macro is difficult. When you debug the Iterative macro, I recommend adding the macro output tool after the macro input tool with the formula tool to which you add the [Engine.IterationNumber].

Labels