Alteryx Designer Desktop Discussions

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

Selection based on Field

rouzu
7 - Meteor

Let say i have this dataset

 

Field1    Field2     Field3

123456 A12345  AA1234

222345 AA2234

                              AA3234

 

What I want to create are new column based on the value in the specific field, like if Field1 contain value and Field2 contain value and Field3 contain value then Field1 value, then if Field2 and Field3 then Field2 value. Lastly, if Field3 then Field3 value.What is the best practice to create the workflow.

4 REPLIES 4
Kenda
16 - Nebula
16 - Nebula

Hey @rouzu! Try to add a Formula tool. Create a new field with the following expression.:

 

iif(contains([Field1],"AA") && contains([Field2],"AA") && contains([Field3],"AA"),[Field1],iif(Contains([Field2], "AA") && contains([Field3],"AA"),[Field2],iif(Contains([Field3], "AA"),[Field3],null())))

You can change the "AA" to whatever value you're testing for. Hope this helps!

rouzu
7 - Meteor

This error are happen when I insert the formula. Can you explain it

Kenda
16 - Nebula
16 - Nebula

@rouzu make sure that all of your fields are strings first or use the tostring() formula in Alteryx. That should get rid of that error for you.

rouzu
7 - Meteor

Thanks I'm manage to do it. So, It is the best practice way to represent the output or have another trick to do it 

Labels