Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Value won't Trim

Hello - I'm trying to trim trailing spaces in a field where it contains ID:

Load:

trim([ID])

Value:

70138000000jzWsADM 

for example the above has a space at the end and after the load, the space still exists!

Any help would be greatly appreciated - thank you!

-Jason

1 Solution

Accepted Solutions
Not applicable
Author

This was really close! I used =Ord(Right([ID],1)) and found out the chr was 160 instead of 32 and used

PurgeChar(ID,Chr(160)) as ID

Thanks again Sunny for the speedy response!

-Jason

View solution in original post

7 Replies
tamilarasu
Champion
Champion

Jason,

Try,

Replace(ID,' ','')


OR


PurgeChar(ID, chr(32) )

sunny_talwar

What about this:

LOAD

PurgeChar(ID, ' '&Chr(32)) as ID

Not applicable
Author

Tried and didn't work - I found out a method in another thread to look for the chr of the space and it is actually a non-breaking space chr160 - so a purgechar worked instead.

Thanks Tamil!

Not applicable
Author

This was really close! I used =Ord(Right([ID],1)) and found out the chr was 160 instead of 32 and used

PurgeChar(ID,Chr(160)) as ID

Thanks again Sunny for the speedy response!

-Jason

sunny_talwar

Awesome, that was a smart way to determine what the CHR was. I am going to keep that in mind for the future.

If you got what you wanted, please close this thread by marking your answer as correct and any other helpful responses.

Best,

Sunny

Not applicable
Author

Thanks for the reminder! Just marked as correct.

tamilarasu
Champion
Champion

Glad you found the solution. Usually trim removes any leading and trailing spaces. I suspect something was there other than space and causing the problem. But I didn't thought about the non breaking space at the time.