In case you missed the announcement: Alteryx One is here, and so is the Spring Release! Learn more about these new and exciting releases here!

Alteryx Designer Desktop Discussions

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

Formula Tool Question – Populating a column based on workflow data

AverySimecka
5 - Atom

Hello,

 

Hopefully this is an easy question. I am trying to populate a column within my workflow based on data from my input file. The column I need populated is called “Master Industry” and there are 2 criteria that determine which column of information (in my data set) is what needs to be populated.

 

Where the RFI Code (column E) is “F” then I need the “Shipper” (column F) to populate as the Master Industry (column D). (If I were doing this manually in excel, I would simply copy the content of column F into column D for that row.)

 

Where the RFI code is “R” I need the “Care Of” to populate as the Master Industry if there is a value within this field. If there is no value within the “Care Of” field then I need the “Consignee” (Column H) to populate as the Master Industry.

 

In my mind, there should be a way to do this within the formula tool, but I haven’t been able to determine the exact statement to get this to work.

 

Hopefully below communicates what I am thinking.

AverySimecka_0-1640022924920.png

 

Attached is my Alteryx workflow and my input data file. Below shows the Alteryx tools I am trying to utilize in this simple test. 

 

AverySimecka_1-1640023036873.png

Below shows my input data.

 

AverySimecka_0-1640029156500.png

 

Below shows my desired output.

 

AverySimecka_1-1640029174986.png

 

Thanks in advance! 

 

2 REPLIES 2
AngelosPachis
16 - Nebula

Hi @AverySimecka ,

 

If statements in Alteryx are formed as:

 

 

IF condition1 then statement 1
ELSEIF condition2 then statement2
.
.
ELSE statementN
ENDIF

 

 

In your occasion, I would try:

 

 

IF [RFI Code]="F" THEN [Shipper]
ELSEIF [RFI Code]="R" AND !ISEMPTY([Care Of]) THEN [Care Of]
ELSEIF ISEMPTY([Care Of]) THEN [Consignee]
ELSE NULL()
ENDIF

 

 

I would also add a select tool before your formula tool and change the data type for the column Master industry to a V_String as well.

 

Let me know if that works for you.

 

Cheers,

Angelos

AverySimecka
5 - Atom

Angelos - that worked! I appreciate your help. 

Labels
Top Solution Authors