We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

trim on number

simran_dua
7 - Meteor

Hi all

 

I need to trim a column which has a number from 11 digits to 10 digits . 

 

I tried converting it to string first using the "Tostring" function . (I created a new column to do this ) 

 

Post that the "Metadata" showed the type to be V_String . 

 

The new column I created above which did show the format to be V_string , I used that for the trim function but it gave me an error 

Parse error at char (0) : Type mismatch. Number provided where a string is required .

 

 

otherwise is there some way to trim a number ?

 

can you please suggest what should I do ?

 

thanks 

6 REPLIES 6
fmvizcaino
17 - Castor
17 - Castor

Hi @simran_dua ,

 

You can use the formula tool to trim left or right as example attached.

Take a look and let me know if that works for you.

 

Best,

Fernando Vizcaino

DiganP
Alteryx Alumni (Retired)

@simran_dua you can use a select tool to convert the number to a string or Vstring. Then in the formula tool, you can use left([field],10) or right([field],10) to get the left or right left numbers, respectively. 

Does that help?

Digan
Alteryx
simran_dua
7 - Meteor

Hi 

 

thank you both of you for the quick replies 

 

I tried doing the same , but still does not work . 

 

even though the input file metadata shows that "Header field name " is "V_string"

 

fmvizcaino
17 - Castor
17 - Castor

Hi @simran_dua ,

 

The only thing you are missing are the quotes in the 2nd parameter.

trim([Filed name],'5')

 

But you need to use trimleft or trimright to remove character from the sides. Trim function as you wrote will remove the number 5 from the edges of your number. For example, the number 515 = 1, 15 = 1

 

Best,

Fernando Vizcaino

simran_dua
7 - Meteor

thank you so much .

novice1
8 - Asteroid

how can trim DateToday() to display only year and have this in Date format?

Labels
Top Solution Authors