Alteryx Designer Desktop Discussions

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

How do I do a for loop without using the Python tool?

novalcia
7 - Meteor

I have 2 data files: DataA and DataB

 

DataA is a huge data file consisting of many columns and rows. Here's an example of DataA with only the relevant columns:

Acc_numDKDK_Acc_A
1001.1DD_1001.1
1004.1DD_1004.1
1100.1KK_1100.1
1002.1KK_1002.1

 

DataB only have a few columns and rows. Example of DataB:

Book_numAcc_numDKDK_Acc_B
11001.1DD_1001.1
11001.2DD_1001.2
11002.1KK_1002.1
11002.3KK_1002.3
21004.1DD_1004.1
21100.1K

K_1100.1

 

I want to get the value from column Book_num in DataB for rows in DataA whose DK_Acc value matches in both datasets. Basically what I want to do is this:

 

For (number of rows in DataA):

For (number of rows in DataB):

if (DK_Acc_A = DK_Acc_B) then

# Make new column in DataA called Match, and put the value of column Book_num from DataB

DataA.Match = DataB.Book_num

endif

next

next

 

Expected DataA output:

Acc numDKDK_Acc_AMatch
1001.1DD_1001.11
1004.1DD_1004.12
1100.1KK_1100.12
1002.1KK_1002.1

1

 

Idk how to do this in Alteryx at all. I watched videos and found alteryx questions about using the Multirow formula tool, but it only gets like 2 or 3 rows before and after the active row. But what I want to do is to iterate through all rows to find the match.

 

I want to avoid using the python tool because this workflow will be passed on to someone else who doesn't programming at all, so I want to keep it simple using only alteryx tools.

4 REPLIES 4
geraldo
13 - Pulsar

@novalcia 

 

Below is a workflow example of an idea on how to simulate loops without Python

Qiu
21 - Polaris
21 - Polaris

@geraldo 
It is very considerate that you union back the data from the "L" and "J" anchor. 😁

@novalcia 
I will do the same as @geraldo and only add one Select for clarity.

As you can see, we can easily do the Joining in Alteryx rather than using looping.

Capture1c.PNG

sparksun
11 - Bolide

I think a simple Join tool can make it, pls correct me if I have any misunderstanding.

333.jpg

 

CoG
13 - Pulsar

Or even simpler join tool that is based entirely on the "code" snippet that you provided (as you can see; there are a number of a ways to square a circle with Alteryx and depending on your needs you can create a workflow as simple or complex as you'd like!):

Join Tool 1.png

Join Tool 2.png

Labels