Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Don't forget to submit your entry for the Excellence Awards by October 30! | Need more information about the program? Check out the blog here
SOLVED

Removing the first character of the column

Highlighted
8 - 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

Highlighted
8 - 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

Highlighted
14 - Magnetar
14 - Magnetar

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.

Highlighted
8 - Asteroid

Thank you for the solution!

Highlighted
5 - 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!
Highlighted
6 - 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!

Highlighted
14 - Magnetar
14 - Magnetar

Hi @ItsDan 

 

For your use case, I would recommend this expression:

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

 

 

Highlighted
8 - Asteroid

You have no idea how many times I played around with her formula to try and figure this out!!!!

 

You are awesome PauloHS!

Highlighted
6 - Meteoroid

Brilliant, it actually saved my life! Thank you @Kenda !

Labels