
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Tags:
- qlikview_scripting
- « Previous Replies
- Next Replies »
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you try Trim() function?
Trim(Your_Column_Name) this should remove the spaces.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
to only trim trailing spaces, you can use RTrim() :
LTrim() only trims leading spaces
and Trim() both leading and trailing spaces.
hope this helps
regards
Marco


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Trim(Your_field_name)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Rtrim(material_description) is not removing the spaces at the end

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
did u concatenated those fields?
if yes
trim(Material) & '_ ' & rtrim(Material_description) as Material_and_Description,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I used this function but the spaces at the end of the material description is still not removed.

- « Previous Replies
- Next Replies »