Alteryx Designer Desktop Discussions

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

ADD Space to text not to numbers

deepakpintya
7 - Meteor

Hi Team, 

I want to add single space to texts and not to numbers. I just need space to text fields.

deepakpintya_0-1663006305546.png

 

9 REPLIES 9
Luke_C
17 - Castor

Hi @deepakpintya 

 

Assuming you want to add a space after the text, this would work. Otherwise feel free to modify how you see fit:

 

IF isinteger([Root Cause]) 
then [Root Cause]
Else [Root Cause] + ' ' 
Endif
IraWatt
17 - Castor
17 - Castor

Hey @deepakpintya,

Assuming you want to add the text to the beginning you can use the regex match formula like this:

REGEX_Match([Root Cause], "\d+")

This will return True if only digits are present.

 

Put that in an if statement and you can add a space if it is not only numbers: 

IF REGEX_Match([Root Cause], "\d+") THEN [Root Cause] ELSE " " + [Root Cause] ENDIF

IraWatt_0-1663006680424.png

The community has some quick and easy videos on formulas and the Formula Tool here https://community.alteryx.com/t5/Interactive-Lessons/tkb-p/interactive-lessons/label-name/Writing%20...

 

If you want to learn more about Regex the community has some really quick interactive videos on getting to grips with it here https://community.alteryx.com/t5/Interactive-Lessons/tkb-p/interactive-lessons/label-name/Parsing%20...

 

Any questions or issues please ask

Ira Watt
Technical Consultant
Watt@Bulien.com 

 

 

deepakpintya
7 - Meteor

Its not worked. 

IraWatt
17 - Castor
17 - Castor

@deepakpintya did you want to add a space to the beginning or end?

deepakpintya
7 - Meteor

Beginning. 

IraWatt
17 - Castor
17 - Castor

@deepakpintya how did my example workflow not work for you?

deepakpintya
7 - Meteor

unable to output but regex formula worked. In output its coming without space. 

IraWatt
17 - Castor
17 - Castor

@deepakpintya It does seem to work with CSV just not Excel not sure why (works fine here with CSV):

IraWatt_0-1663008689103.png

 

deepakpintya
7 - Meteor

I have huge data with many coulmns, if i change to CSV from EXCEL then its not getting reconcile.

Labels