
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Remove last substring from a string
Hi there, I have a field (called GROUP) containing multiple strings like this one:
Group1/Group2/Group3/Group4/Group5
and so on.
I don't always have the same number of substrings (divided by the '/'), sometimes there are more than 5 and sometimes less than 5.
I'd like to remove from these strings the last subfield, intependently of the number of substrings.
Has anyone any clue about how could I get this done?
- Tags:
- qlikview_scripting
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
As long as you have at least two substrings this should work for you
Left(GROUP ,Index(GROUP,'/',SubStringCount(GROUP,'/'))-1)
Regards
Adrian

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
use the formla: =SubField('Group1/Group2/Group3/Group4/Group5','/',-1)
it retreives the last subfield after the defined character from right (defining -1)
instead of hardcoded text use your data field


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
As long as you have at least two substrings this should work for you
Left(GROUP ,Index(GROUP,'/',SubStringCount(GROUP,'/'))-1)
Regards
Adrian

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, but that's not what I'm looking for, I wanted to keep the rest of the string, not the last one.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, it worked perfectly!
I was assuming it had to do with the Index function.
