Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Trim Field values

UGSCU-G

QUSJIE-G

when field values are like this if i want to omit the '-G' just to get

UGSCU

QUSJIE

????

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Left(FIELDNAME, index(FIELDNAME,'-',1)-1) as FIELDNAME

View solution in original post

10 Replies
Anonymous
Not applicable
Author

If you always want to remove every instance of '-G', then you can just use:

Replace(FIELDNAME, '-G', '') as FIELDNAME

Not applicable
Author

sorry not to mention that there are also other values as

KSIJED-M

OQKDL-C

by using above condition replace i can eliminate -G but how about '-M' & '-C' from the field values??

Anonymous
Not applicable
Author

Well, if the '-G/M/C' is always at the end of the string, it might be easier to just pick everything on the left of the first '-'. Something along these lines:

Left(FIELDNAME, index(FIELDNAME,'-',1)) as FIELDNAME

Not applicable
Author

THE ABOVE EXPRESSION RETURNs the values with ending '-' as

KSIJED-

OQKDL-

UGSCU-

QUSJIE-

i tried to change the position number still the same outcome??

Anonymous
Not applicable
Author

Left(FIELDNAME, index(FIELDNAME,'-',1)-1) as FIELDNAME

Not applicable
Author

THANKS JOHN.

Not applicable
Author

Hi

this is good

but if we have different symbols in the values

then how we use this expr

like _,-,&,#,@

this type of special characters how to remove this

all in one field values

Anonymous
Not applicable
Author

If you're only looking to remove certain characters, use the function PurgeChar()

Not applicable
Author

Hi

thanks

purgechar()

it give all values without symbols

but i need to trim from that special character onwords

like above exm

Left(FIELDNAME, index(FIELDNAME,'-',1)-1) as FIELDNAME

here how to use multiple symbols