Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

New Column Based On a Join & Conditions

Masond3
8 - Asteroid

Hi Team, 

 

Hope your well .

 

I am hoping you can help me (My mind is drawing a blank) 

 

I have 2 input files which consists of the following ;


Input 1 

IDPractice_ID
001j000000eKjdHAAS123456


Input 2:

IDPractice_ID
001j000000eKjdAAAS123456
001j000000eKjdCAAS123456
001j000000eKjdDAAS123456
001j000000eKjdEAAS123456
001j000000eKjdFAAS123456
001j000000eKjdGAAS123456
001j000000eKjdHAAS123456
001j000000eKjdIAAS123456
001j000000eKjdiAAC123456


What i would like to do is following ;

 

1) Using Id in "Input 1" search for the Id in "Input 2"  and when the IDs match then in a new Column called "Outcome" tag the Record "HQ" 


2) Where the Remaining Ids & Practice Id doesn't match back to "input 1" then in the Outcome column tag "Office"


3) Produce a new Column called "Parent id"


4)Populate the HQ ID in the "Parentid" field where the HQ Practice_ID matches the other Practice_ID

NB : Where Outcome = HQ, Parentid should be blank  


Expected OutCome : 

IDPractice_IDOutcome Parentid 
001j000000eKjdAAAS123456Office001j000000eKjdHAAS
001j000000eKjdCAAS123456Office001j000000eKjdHAAS
001j000000eKjdDAAS123456Office001j000000eKjdHAAS
001j000000eKjdEAAS123456Office001j000000eKjdHAAS
001j000000eKjdFAAS123456Office001j000000eKjdHAAS
001j000000eKjdGAAS123456Office001j000000eKjdHAAS
001j000000eKjdHAAS123456HQ 
001j000000eKjdIAAS123456Office001j000000eKjdHAAS
001j000000eKjdiAAC123456Office001j000000eKjdHAAS

 


Looking forward to your response 

Masond3

6 REPLIES 6
mceleavey
17 - Castor
17 - Castor

Hi @Masond3 ,

 

a little bit of joining and multi-row magic did the trick.

 

mceleavey_0-1614278946864.png

 

 

I've attached the workflow for you.

Hope this helps.

 

M.



Bulien

Masond3
8 - Asteroid

Hi @mceleavey 

Thanks for sending this across. 

Whilst testing your flow with some different scenarios ie additional Ids & Different Practice ID for the second input file, i have noticed that on the final output one parentid is being stamped for all the Offices 

I have re attached your flow with the example set i was testing with.

Regards
Masond3

mceleavey
17 - Castor
17 - Castor

Exactly.

What is it you wanted? There was only one in the original question.

Which one do you want to be stamped?



Bulien

mceleavey
17 - Castor
17 - Castor

Sorry, got it.

I was being an idiot.

 

M.



Bulien

Masond3
8 - Asteroid

Hi @mceleavey 


For a given Practice id and the Outcome = Office, then the parentId field should be populated with the HQ id for that practice id 

 

For example

 

 

IDPractice_IDOutcomeParent
001j000000eKga2AAC18000062HQ 
001j000000eKincAAC18000062Office001j000000eKga2AAC
001j000000eKgo7AAC18000105Office001j000000eKjbJAAS
001j000000eKjbJAAS18000105HQ 
001j000000eKjbIAAS18000105Office001j000000eKjbJAAS
001j000000eKgocAAC18000149HQ 
001j0000018keiqAAA18000149Office001j000000eKgocAAC
001j000000cVKanAAG18000169Office001j000000eKj7iAAC
001j000000eKj7iAAC18000169HQ 
001j000000cVKS2AAO18000172Office001j000000eKj7jAAC
001j000000eKj7jAAC18000172HQ 
001j000000eKgosAAC18000185HQ 
001j000000eKjbRAAS18000185Office001j000000eKgosAAC
001j000000eKjbQAAS18000185Office001j000000eKgosAAC
001j000000eKgovAAC18000192Office001j000000yRSIdAAO
001j000000yRSIdAAO18000192HQ 
001j000000eKgpuAAC18000287HQ 
001f100001ZXkSrAAL18000287Office001j000000eKgpuAAC
001j000000eKgq5AAC18000309Office001f100001DOViHAAX
001f100001DOUe8AAH18000309Office001f100001DOViHAAX
001f100001DOViHAAX18000309HQ 
001j000000eKjbjAAC18000309Office001f100001DOViHAAX
001j000000eKjbiAAC18000309Office001f100001DOViHAAX
001j000000eKjbhAAC18000309Office001f100001DOViHAAX
001j000000eKjbgAAC18000309Office001f100001DOViHAAX
001f100001Ye0NQAAZ18000309Office001f100001DOViHAAX
001j000000eKjdAAAS123456Office001j000000eKjdHAAS
001j000000eKjdCAAS123456Office001j000000eKjdHAAS
001j000000eKjdDAAS123456Office001j000000eKjdHAAS
001j000000eKjdEAAS123456Office001j000000eKjdHAAS
001j000000eKjdFAAS123456Office001j000000eKjdHAAS
001j000000eKjdGAAS123456Office001j000000eKjdHAAS
001j000000eKjdHAAS123456HQ 
AngelosPachis
16 - Nebula

Hi @Masond3 ,

 

Based on M solution, can you try sticking the part inside the comment box in the workflow and see if that does it

 

AngelosPachis_0-1614331458792.png

 

It essentially filters out the "HQ" and then joins them back based on the Practice ID. Then the formula assigns the Parent ID.

 

Regards,

 

Angelos

Labels