Alteryx Designer Desktop Discussions

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

Updating Fields in One Input from Another Input Based on Criteria

JoeDen
5 - Atom

All  - As my question will show, I'm quite new to Alteryx. I"m trying to update a field in one data source 'PatientInfo' based on whether or not the information appears in another data source 'PatientInfoUpdates'.   Sample data follows: 

Patient Info

NameIDGender
Adam1

M

Bob2M
Carol3F

 

PatientInfoUpdates

NameNewIDGender
Adam4M
Carol5M
David6M
   

What I'm trying to do is change ID in PatientInfo to reflect the new values in PatientInfoUpdate (assume the Name matches are unique). I can see the differences by using the join tool on name and seeing the results, but can't figure out how to write the new values back to ID in PatientInfo. I'm working with the results of the join tool,  which returned 2 rows, one for Adam and one for Carol as expected. I've tried a formula like this:

FormulaBad.PNG

 

which errors out.  I'd appreciate any ideas you all might have. 

 

 

 

 

Thanks in advance.

 

 

4 REPLIES 4
DanS
9 - Comet

Hey Joe, 

 

You are on the right track just need to add the ELSE statement and choose column - ID for the Output Column (to update):

IF [ID] != [NewID] THEN [NewID] ELSE [ID] ENDIF

That should work for you.

 

Thanks,

Dan

Kenda
16 - Nebula
16 - Nebula

Hey @JoeDen! As you stated, since you are joining on the name field, you are under the assumption that they will be the same in order to come out the J. 

 

To fix your error, if you want to update the ID field, do not put a new field name in the Formula configuration for Output Column. Instead, select your ID field. Then, in the expression, you will want to take out the "[ID]=" portion. The way the if statement works in Alteryx, after the 'then' and before the 'else' you just have to put the value you want the output column you chose to be equal to. See the example below for a better visual. Hope this helps!

 

New ID.PNG

JoeDen
5 - Atom

Thanks DanS! I appreciate your time and quick response.

JoeDen
5 - Atom

Thanks! I appreciate the visual! You and DanS were both lightning quick. Looking forward to the day I can contribute as well.

Labels