Alteryx Designer Desktop Discussions

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

If column is not empty, then replace another column with it

castaff
5 - Atom

My data are structured such that I have one column with origin data, and one column with updated location data, and I am trying to make a column of "current" location. Updated location is only populated when relevant and is often blank. 

 

castaff_0-1571854776276.png

I am trying to use a multi-field formula tool with the following logic: 

 

IF (!IsEmpty([New Location])) THEN Replace([Origin], "(.*.*)",[New Location]) ELSE [New Location] ENDIF

 

Unfortunately the if statement doesn't seem to be effective, and the entire origin column is blanking out and being populated with the "New Location," so now Origin is just a copy of New Location. Similarly, if I replace the New Location in the ELSE statement with Origin, the New Location column then just is a copy of the Origin column. 

 

What I am hoping to get in the Origin column is this: 

 

canada

japan

argentina

mexico

 

Any assistance is much appreciated.

 

3 REPLIES 3
BrandonB
Alteryx
Alteryx

Set column being updated to Origin at the top of the formula in a regular formula tool

 

IF !IsEmpty([New Location])

THEN [New Location]

ELSE [Origin]

ENDIF

 

castaff
5 - Atom

I was definitely trying to over complicate. Thank you!

BrandonB
Alteryx
Alteryx

You had the right idea, Alteryx just operates in a slightly different manner. A good way to think about it is that the formula is updating the column that you have set up top. Whatever formula that you specify is going to update the values in this particular column. Any other columns that need their own updates will require their own formulas.

 

You can use values from multiple columns in your formula, but you are ultimately updating the values in one column per formula. 

Labels