Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Map Substring Extra Spaces

Hi All,

Again, apologies, I'm been using Qlikview for 3 months so this question may seem daft. I asked an earlier question about using map substring to match a string column to a list of keywords and they're corresponding segment. My next (and hopefully) last question is can map substring deal with extra spaces at the end of a string patter. See the code below:

MapTable_Key_1:
Mapping LOAD Pattern,'{<'&Seg&'>}' as Seg Inline [
Pattern,Seg
'PATTERN_1A',SEGMENT1
'PATTERN_1B ',SEGMENT1
]
;

TAB:
LOAD *,
if(len(TextBetween(MapSubString('MapTable_Key_1',Field),'{<','>}')) > 0, TextBetween(MapSubString('MapTable_Key_1',Field),'{<','>}'), 'OTHERS') AS Segment
Inline [
Field
Text and Text and PATTERN_2A and More Text PATTERN_1A
Text and Text and fPATTERN_1Bf and More Text
Text and Text and and More Text PATTERN_2A
Something Else]
;

In the underlined line above, I would prefer this string to be matched to "OTHERS" as it does not contain "PATTERN_1A" or "PATTERN_1B ". Notice the extra space at the end of the latter string. Is it possible for the mapping table to recognise the extra space? At the moment it seems to be ignoring the extra space and assigning "SEGMENT_1" to this string.

Thanks to everyone on this community page for helping me so far with my learning of Qlikview.

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try setting system variable (beginning of the script) like:

set Verbatim = 1 ;


Capture.PNG

Verbatim ‒ QlikView

View solution in original post

2 Replies
tresesco
MVP
MVP

Try setting system variable (beginning of the script) like:

set Verbatim = 1 ;


Capture.PNG

Verbatim ‒ QlikView

Anonymous
Not applicable
Author

Wow. Didn't think that it would be that simple. Thank you so much!