Alteryx Designer Desktop Discussions

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

Removing variables in records.

Tahir89
7 - Meteor

Hi, 

 

I'm looking at two columns: 

 

Name 1              Name 2

alpha Kilo  1       alpha 

beta 1                 xray 

 

How can I Alteryx to search create move the Name 2 variable in Name 2?

 

5 REPLIES 5
fmvizcaino
17 - Castor
17 - Castor

Hi @Tahir89 ,

 

I'm attaching two methods, one with trim left considering that what you want to remove is at the beginning of your cell and also another one replacing every match.

 

Best,

Fernando Vizcaino

grossal
15 - Aurora
15 - Aurora

Hi @Tahir89,

 

could you provide a bit more context and information?

 

The first example looks like you want the first word. I you always want to have the first word, you could use a Formula, Regex or even the Text-to-Columns tool.

 

What is the second row telling us? 'beta 1 -> xray' ? What's the rule behind this?

 

 

Best

Alex

Tahir89
7 - Meteor

Hi Grossal, the rule would be:

 

if Column_A contains Column_B remove column_B variable from column_A

 

the word can be at any position. 

AbhilashR
15 - Aurora
15 - Aurora

Hi @Tahir89, you could use a formula tool to achieve this result. The formula would like something like:

TRIM(
IF Contains([Name 1],[Name 2])
	THEN REGEX_Replace([Name 1],[Name 2],'')
ELSE [Name 1]
ENDIF
)

Attached is an implementation of this formula. Hope this helps. 

grossal
15 - Aurora
15 - Aurora

Hi @Tahir89,

 

sorry for being late to the party. I know that @AbhilashR already showed a solution, but here is another one.

 

You can use the basic "Replace" function without any checking if the word is contained or not, because nothing will happen if it isn't contained.

 

grossal_0-1585933107022.png

 

Workflow attached.

 

Best

Alex

Labels