Discussion Board for collaboration on QlikView Scripting.
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
Go to Solution.
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
Can you try Trim() function?
Trim(Your_Column_Name) this should remove the spaces.
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
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
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
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
Rtrim(material_description) is not removing the spaces at the end
did u concatenated those fields?
trim(Material) & '_ ' & rtrim(Material_description) as Material_and_Description,
I used this function but the spaces at the end of the material description is still not removed.