Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Looping logic

praneshsapmm
8 - Asteroid

Hi,

 

Below is the loop requirement . 

 

Based on id and parent id , column new_pid need to be calculated . id can go upto thousands . 

 

id code parent id new pid 
1V0100
2V021V01
3V032V01,V02
4V045V03,V02
5V053V01

 

Any help is appreciated. Thanks.

5 REPLIES 5
Qiu
21 - Polaris
21 - Polaris

@praneshsapmm 
Can you give more about the logic here?

It appears to be that for id 4 the new pid should be V05, V01, V02?

Nandakishore
8 - Asteroid

Hi @Qiu ,

 

Absolutely correct. my mistake . 

 

Thanks.

Qiu
21 - Polaris
21 - Polaris

I think we can use this macro to generaate the hierarchy first then the rest will be easy,

0204-praneshsapmm.png

Nandakishore
8 - Asteroid

Hi @Qiu  ,

 

The solution works beautifully for now . But the only challenge is the how the values are sorted in new_pid .

 

As the iterations increase at times , the sorting is not correct . 

 

I mean first the values of lowest parentid need to be available followed by the later one in column new_pid . can you help .

 

Thanks .

Qiu
21 - Polaris
21 - Polaris

@Nandakishore 
I think we can add one Sorting tool to resolve this issue.

0204-praneshsapmm-r1.png

Labels
Top Solution Authors