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

Qlikview script function to remove leading spaces at the end

Hi,

I want to know to how to remove the spaces at the end of the string.

Eg: the qlikview is a learning tool. 

Qlikview is analytics tool.          

The length of the string varies and the spaces of the string varies to each string.. For eg.. The string 1 contains 5 leading spaces at the end..

The 2nd string contains 10 leading spaces at the end..I can't use replace function for removing because it will remove all the spaces including the spaces in between the string...

Can u please provide solution for the issue..

Message was edited by: vinu priya

30 Replies
Not applicable
Author

I couldn't find any option for attaching the excel files. Only I'm able to see video and image attachments. Can you please share you mail_id. So that i can share the sample data

avinashelite

Sharing your original problem file would be better to identify the problem

Not applicable
Author

Here I have attached the sample data. Can you please check and provide some solution

Kushal_Chawda

I think there are some white spaces in your excel file cells.

Just copy one of the cell value from excel in notepad, copy that value from notepad and replace it in QlikView with Blank value.

Works for me. See the below. Also

Data:
LOAD KeepChar([  Material],'0123456789') as Material,
rtrim(replace([Material Desc                          ],' ',' ')) as Material_Description
FROM
[test1(1).xlsx]
(
ooxml, embedded labels, table is Sheet1);

In above replace function first blank space is copied from notepad which we are replacing with blank

swuehl
MVP
MVP

You can remove all kinds of whitespace when loading the data in, like this

Purgechar( Material, Chr(09) & Chr(32) & Chr(160) & Chr(12288)) ) as Material

Kushal_Chawda

Yes swuehl‌ you are correct, But issue is that white spaces are there in between values also so if we directly remove that Values,it will not be readable.

swuehl
MVP
MVP

Wouldn't the same apply to a Keepchar(Material,'1234567890')?

But it should be save to use

Trim(Replace( Material, Chr(09) & Chr(160) & Chr(12288),chr(32) ) ) as Material

Kushal_Chawda

It should be apply on Material Description.

swuehl
MVP
MVP

To whatever field you like....

Not applicable
Author

Hi Kushal,

Thanks for your help.. It is working fine now

Community Browser