Start Free Trial

Alteryx Designer Desktop Discussions

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

Find the nearest row for direct parent

hatudu95
7 - Meteor

I am looking for a way to get Parent column populated. I tried multi row tool but doesnt work. Hi, the first 2 columns are the input and I am looking to get column parent  as desired output. 

 

That is the illustrative dummy data. the name could be anything but the ownership indicator is the key. So 1 means ultimate parent. 2 is direct child of ultimate parent. 3 is direct child of nearest 2 above it. For example, Direct parent of child D is C as C is nearest to D, not B 

 

NameOwnership indicatorParent
A1 
B2A
C2A
D3C (nearest above is C)
F4D
G3C
H2A

 

8 REPLIES 8
abacon
13 - Pulsar

@hatudu95 Is the above table the desired output or the current output you are getting? It isn't clear what you are trying to do here.

 

Bacon

Gaurav_Dhama_
12 - Quasar

You just use join, i am assuming you are using ownership indicator to identify the parent.

lets call input is A,

Add formula tool to A output, add 1 to ownership. That will give 2 for A, 3 for B and C and so on.

once you have that, sort by owner in desc and id in Asc.

Now take unique group by on owner, that will leave you with, A 2, C3, etc.

join it with your initial input on indicator.

you will get the parent.

 

jrlindem
12 - Quasar

@hatudu95 are you literally trying to map:

  • 1 = A
  • 2 = B
  • 3 = C
  • etc.

Or is that just illustrative dummy data?  On the off chance you literally just need to map numbers to letters and you want to follow a traditional Alpha-ordering...

You could use a formula like:

 

Char([Ownership indicator] + 96) for lowercase letters
or
Char([Ownership indicator] + 64) for uppercase

 

I'm guessing this isn't what you're after, but just in case, I figured i'd throw it out there!  Otherwise, go with @Gaurav_Dhama_ 's response 😁

hatudu95
7 - Meteor

Hi, the first 2 columns are the input and I am looking to get column parent  as desired output

hatudu95
7 - Meteor

That is the illustrative dummy data. the name could be anything but the ownership indicator is the key. So 1 means ultimate parent. 2 is direct child of ultimate parent. 3 is direct child of nearest 2 above it. For example, Direct parent of child D is C as C is nearest to D, not B 

hatudu95
7 - Meteor

Hi, I tried to follow but couldnt. Do you have a workflow. Thank you very much

aatalai
15 - Aurora

@hatudu95 built it via a batch macro looking at each row in turn to find which row was the first to meet the ciretria and seems to work. Please take a look and let me know how you get on

 

Screenshot 2025-08-15 115243.png

 

 

Gaurav_Dhama_
12 - Quasar

Check out the attached workflow, it does not use any macro, since it does not get inside a loop, it will be faster in case you run it over a larger data.

Labels
Top Solution Authors