Alteryx Designer Desktop Discussions

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

Query for Loop in Alteryx

swapnilm
5 - Atom

I have a dataset that is variable in size however number of headers remains same.

 

1) If user gives the Field and Source, then it should look into the To Field and To Source and get the From Field and From Source

 

2) Now again the latest information that we have from From Field and From Source, it will look again into the To Field and To Source and get the relevant From Field and From source

 

3) This look should go on till we don't get the information in To Field and To Source.

Note: It should be Inner Join (Both fields (Field and Source should match between "To" and "From")

Number of layers or numbers of loops it will be variable in the datasets.

 

For Eg, If we have the below datasets:

From FieldFrom SourceTo FieldTo Source
ABCFinal v1ABCFinal
ABC5Final v2ABCFinal v1
ABC6Initial 2ABC5Final v2
ABCInitial 1ABC6Initial 2
JKL1Final v1JKLFinal
JKL1Final v2JKL1Final v1
JKL12Final v3JKL1Final v2
JKL12Initial 1JKL12Final v4
JKLInitial 2JKL12Initial 1

 

I am expecting the below output:

 

FieldSourceFrom FieldFrom SourceFrom Field 1From Source 1From Field 2From Source 2From Field 3From Source 3From Field 4From Source 4
ABCFinalABCFinal v1ABC5Final v2ABC6Initial 2ABCInitial 1NANA
JKLFinalJKL1Final v1JKL1Final v2JKL12Final v3JKL12Initial 1JKLInitial 2

 

Above two columns highlighted in blue it will be given or taken as the reference.

 

Please let me know if this can be possible within Alteryx.

 

 

3 REPLIES 3
AndrewDMerrill
13 - Pulsar

This is possible with Iterative macros. I may be able to throw something together tomorrow or someone else can jump in and handle it.

 

This is very similar to the Weekly Challenge problem: https://community.alteryx.com/t5/Weekly-Challenge/Challenge-12-Creating-an-HR-Hierarchy/td-p/36740

 

Regardless of whether I can be of further help or someone else can, Happy Solving!!!

AndrewDMerrill
13 - Pulsar

Looks like I got to it after all! Here is a sample I just threw together. Hopefully, it works for you:

_Main.png

Macro:

_Macro.png

swapnilm
5 - Atom

Thanks Andrew! Will try the same. 

Labels