Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Replace a String in a Column with Other Column Value

luqmantmf
7 - Meteor

Hi Community,

I've a case as below:

Table:

luqmantmf_0-1681116936014.png

 

How can I dynamically replace [Field1] and [Field2] values on Field Output?

If I'm using table above as input data, after workflow running, the output should be:

luqmantmf_2-1681116974975.png

Please note that number of reference Field (Field1, Field2) and output combination can be changed based on user input. 

 

Thank you.

 

Best Regards,

Luqman

6 REPLIES 6
ShankerV
17 - Castor

Hi @luqmantmf 

 

This can be achieved with the help of Regex/Text to columns tool.

Then use the formula tool to achieve the output.

 

Many thanks

Shanker V

PhilipMannering
16 - Nebula
16 - Nebula

HI @luqmantmf 

 

Something like this should work,

PhilipMannering_0-1681117777361.png

 

PhilipMannering
16 - Nebula
16 - Nebula

@ShankerV How is this helpful if you don't rpovide the regex or formula to complete the task? You might as well reply with "This can be achieved using some Alteryx Tools"

PhilipMannering_0-1681118060457.png

 

ShankerV
17 - Castor

Hi @luqmantmf 

 

There are many ways to do this as @PhilipMannering also suggested a way to do this.

 

I was trying to save the workflow, however was throwing an error. Below are my steps to achieve the solution with 2 tools.

 

Output:

 

ShankerV_0-1681118381046.png

 

Step 1: Input 

 

ShankerV_1-1681118747312.png

 

Step 2:

 

ShankerV_2-1681118768359.png

 

ShankerV_3-1681118778071.png

 

Step 3:

 

ShankerV_4-1681118794221.png

 

ShankerV_5-1681118818785.png

 

IF [Field Output1]=[F1]
THEN [Field1]
ELSE [Field2]
ENDIF

 

IF [Field Output2]=[F2]
THEN [Field1]
ELSE [Field2]
ENDIF

 

[Field Output1]+", "+[Field Output2]

 

Step 4: Remove unwanted columns

ShankerV_6-1681118857356.png

 

Many thanks

Shanker V

PhilipMannering
16 - Nebula
16 - Nebula

@ShankerV Fair enough. Apologies!

luqmantmf
7 - Meteor

Thank you very much @ShankerV  and @PhilipMannering.

I've got the concept how to perform the action.

Labels