community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Removing the first character of the column

Asteroid

Hi all, I am quite new to Alteryx. I am trying to remove the first character of one column, it is currently a string now.

So ex. 

111a

112b

113c

 

I want to make it so that it'll be

RowID

11a

12b

13c

Asteroid

Hi fangyi189,

 

You can use a formula tool with the built-in string functions in Alteryx to do this. There are a few ways you can achieve this, one way would be to use the formula,

Right([RowID],Length([RowID]) - 1), the minus one will strp off one character from the left of the string, I've attached an example workflow below.

 

Thanks,

 

Michael

Pulsar
Pulsar

Hey @fangyi189! RegEx could also be super helpful here. This expression could be added to a Formula tool and get you what you're looking for:

REGEX_Replace([Field1], ".(.*)", "$1")

Basically, this says keep everything after the first character in Field1.

Asteroid

Thank you for the solution!

Atom
I am not very good with regex, but just to help out someone who may have the same problem than me.
the number of dots before "(.*)" are the number of characters that you may need
example (one char):
REGEX_Replace([Field1], ".(.*)", "$1")
example (two chars):
REGEX_Replace([Field1], "..(.*)", "$1")
example (three chars):
REGEX_Replace([Field1], "...(.*)", "$1")

btw
Thank you Barnesk!
Meteoroid

Hi BarnesK 

 

I've tried this but it says it's not for a numeric field. Is there a similar formula to remove a minus sign from the beginning of a numeric field?

 

thanks!

Pulsar
Pulsar

Hi @ItsDan 

 

For your use case, I would recommend this expression:

replace(tostring([FieldName]),"-","")

 

 

Labels