Start Free Trial

Alteryx Designer Desktop Discussions

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

Find and Replace in top Record Row?

cyeager
8 - Asteroid

My goal is to find and replace "_" underscore values found in the header (record, top row) row of data.  After doing a formula concatenating values, it added several "_".  I would like to replace all "_" with a space, and then have no more then one consecutive space in a row in each of the header fields.  Thanks for you help.

7 REPLIES 7
Qiu
21 - Polaris
21 - Polaris

@cyeager 

A set of sample data would help us to better understand your requirement, but perhaps something like this?

Capture2V.PNG

cyeager
8 - Asteroid

Attached... the goal would be to have the Header row to be renamed to:

Record ID    Field 1 ABC 16ft     Field 2 misc 78in
Thank you!

Hi @cyeager 

 

Is this what you are looking for? Cheers!

christine_assaad_0-1624574546114.png

christine_assaad_1-1624574588987.png

 

Hi @cyeager 

 

I used Regex and Dynamic Rename as below. Hope this helps. 

 

It will go and replace _ repeated once or more with a space. Cheers!

christine_assaad_0-1624575767366.png

 

cyeager
8 - Asteroid

cyeager_0-1624886236227.png

I triple checked my spelling, but it doesn't recognize the variable.  This is an interesting node that I haven't used before... I wonder if it would leave me with 3 blank spots in the middle of the field name, if it worked.  Thank you for the idea. 🙂

cyeager
8 - Asteroid

ah, [_CurrentField_] is actually a variable specific to the Dynamic Rename Node... it worked with removing "_" and potentially trimming, but multiple spaces remained... I wonder if I would then build a find a replace (or formula) of if 4 blanks, replace with 1 blank, if 3 blanks replace with 1 blank, if 2 blanks replace with 1 blank type of script would finish it off.  Thank you for the ideas.

cyeager
8 - Asteroid

Awesome!  REGEX_Replace([_currentField_], "(_+)", " ")   Thanks!

Labels
Top Solution Authors