Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Hierachial Search

Pranee_007
7 - Meteor

I am trying to create two new columns that are underlined below using the data from Source2.

 

Facts about Source2:

 

1. It is a hierarchy model. Main Manager column we are trying to create will always be equal to Manger 1 in Source 2.

2. Source 2 can have different Manager 5 and same Manager 1 (Example: iv3 has different Manager 5)

3. Source 2 can have same Manager 6 and same Manager 1 (Example: iv1 and iv2)

 

Conditions:

1. If Manager in Main file is found in Manager 2 or 3 or 4 or 5, I want the Main manager field to be populated with corresponding Manager 1 from Source 2.

2. If Manager in Main file is found in Manager 1, return the same.

3. If Manager in Main file is found multiple times, I want Manager 1 to be populated only once as it will be same for the same Manager.

 

I want the output as shown below in 'main file'. Please help me build the workflow for the same. Please let me know if you have any questions. Thank you so much in advance.

 

Main file:

AccountText fieldManagerIDMain ManagerMain Manager ID
009898ENTYry500007TRNEN                             /TYry000040TRNSi10608iv10710
389456ENTYry500008TRNEN                             /TYry000040TRNsi5603iv5705
389469ENTITY R0000253 DST ca11510iv9709
389425R0000006DSTas38406iv10710
389478ENTR0000007DSTp0132423iv10710
389445EnTyR0000007DSTinp00258766iv2702
389446ENTYry500007TRNEN                             /TYry000040TRNp00659444iv3703
389447ENTYry500008TRNEN                             /TYry000040TRNp088594844iv3703
389448ENTITY R0000253 DST p00258766iv2702
389449R0000006DSTp092258iv1701
389450ENTR0000007DSTiv1 701iv1 701
389451EnTyR0000007DSTinca2598iv1701

 

Source2

Manager -2M-2 IDManager -1M1 IDManager 0M0 IDManager 1M1 IDManager 2M2 IDManager 3M3 IDWisdomManager 4M4 IDManager 5M5 ID
fd3901  fh1801iv1701       p092258
fd3901  fh2820iv1701  ca2598   p092258
fd4902fm4850fh3832iv2702si2682ca4597das45462p00258766
fd4902fm5851fh3832iv2702si12655ca4597das45462p00258766
fd6903  fh4802iv3703si3685   as2588p00659444
fd6903fm6856fh4802iv3703si19698   as8511p088594844
fd7904    iv4704si4601ca6505ras32849p00719845612
fd8905    iv5705si5603ca7506 as33401p00848465
fd9906    iv6706si6604ca8507Eas34402p0091844
fd10907    iv7707si7605ca9508 as35403p0108885
fd11908    iv8708si8606ca10509Tas36404p011552269614
fd12909    iv9709si9607ca11510 as37405p0124984163
fd13910    iv10710si10608ca12511Eas38406p0132423
fd14911    iv11711si11609ca13512 as39407p0149844
3 REPLIES 3
GiuseppeC
Alteryx
Alteryx

Hi @Pranee_007,

 

this might be a sub-optimal yet simpler solution to implement. If the size of your files allows it, you could consider using the Append Fields tool to append all records/fields from Source2 to your Main file. At that point you'll get a table with all the combination of all rows from the 2 tables.

 

Having the data in this format will allow you to easily build a series or IF-THEN-ELSE statements to implement your conditions.

 

Finally, you could filter out the unnecessary rows.

 

Example attached.

 

Hope this helps, but let me know if you have any questions.

 

Best,

Giuseppe

ChrisTX
15 - Aurora

These related posts may help:

 

1) Alteryx Weekly Challenge #12:

https://community.alteryx.com/t5/Weekly-Challenge/Challenge-12-Creating-an-HR-Hierarchy/td-p/36740

In this example, we have a series of records where you have an employee title, an ID to the title, and the number of the managers’ title ID.

 

2) Generate each tree branch for a hierarchy

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Multilevel-Product-Hierarchy/m-p/42234...

 

3) Process a hierarchy
Crawling Down an Org Structure

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Crawling-Down-an-Org-Structure/td-p/44...

 

Chris

danilang
19 - Altair
19 - Altair

Hi @Pranee_007 

 

For your particular case, you don't need to build a hierarchy since you have the managers table available.

 

w.png

 

Transpose the managers list to all mangers 1-5 in one column.  Join this to the main list to get the main manager fro each row.  Take only the unique rows from this list giving you

 

r.png 

 

Dan

Labels