Do you use Alteryx in a language other than English? If so, we want to hear from you! Please help us improve the international experience of our products by participating in this 5 minute survey.

We are updating the requirements for Community registration. As of 7/21/21 all users will be required to register a phone number with their My Alteryx accounts. If you have already registered, you will be prompted on your next login to add your phone number.

Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
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
15 - Aurora
15 - Aurora

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