Skip to main content
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

1 Solution

Accepted Solutions
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

View solution in original post

30 Replies
sinanozdemir
Specialist III
Specialist III

Can you try Trim() function?

Trim(Your_Column_Name) this should remove the spaces.

martinpohl
Partner - Master
Partner - Master

you can use ltrim and rtrim to trim spaces at the beginning and the end

ltrim(rtrim(yourfield)) as yourfield

trim will also delete spaces between text

Regards

MarcoWedel

Hi,


to only trim trailing spaces, you can use RTrim() :

RTrim ‒ QlikView

LTrim() only trims leading spaces

LTrim ‒ QlikView

and Trim() both leading and trailing spaces.

Trim ‒ QlikView

hope this helps

regards

Marco

avinashelite

RTrim(Your_field_name) // this will remove the spaces at the end

LTrim(Your_field_name) // this will remove the spaces at the start of your statement


Trim(Your_field_name) // this will remove the spaces in both the ends i.e. at the start and at the end of your statements

Not applicable
Author

Hi All,

Thanks for your replies.

I have written function like

trim(Material) & ' ' & rtrim(Material_description) as Material_and_Description,

Because I'm having spaces at both the ends for Material and spaces at the end for material description column.

For material it is working and rtrim for Material description is not working.

Can you please suggest

Not applicable
Author

Trim(Your_field_name)

Not applicable
Author

Rtrim(material_description) is not removing the spaces at the end

Chanty4u
MVP
MVP

did u concatenated those fields?

if yes

trim(Material) & '_ ' & rtrim(Material_description) as Material_and_Description,

Not applicable
Author

I used this function but the spaces at the end of the material description is still not removed.