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: 
rbecher
MVP
MVP

MapSubstring() strange behavior or bug?

Hi all,

we're using MapSubstring() to convert strings into phonetical codes. During our tests we got some strange results. Here is a sample code:

daten:
LOAD * INLINE [
var
Wikipedia
da
dy
dd
dkd
dz
];

testMap1:
mapping LOAD * INLINE [
x, y
d, 1
dy, 2
dz, 3
];

test1:
load var as var1, '#'&MapSubString('testMap1',lower(var)) as test1 resident daten;

testMap2:
mapping LOAD * INLINE [
x, y
d, 1
dy, 2
dz, 3
dh, 4
];

test2:
load var as var2, '#'&MapSubString('testMap2',lower(var)) as test2 resident daten;

The second map don't works right (see attached app). The additional entry "dh" creates the problem. I wonder why.

Any suggestions?

Ralf

Astrato.io Head of R&D
3 Replies
Not applicable

Ralf,

I think its because testMap1 and testMap2 have the same structure (both consist of fields x and y). Try changing 'x' to 'xx' and 'y' to 'yy' in testMap2.

Regards,

Gordon

rbecher
MVP
MVP
Author

Gordon,

this is not the problem. We tried it before. Even if only the second mapping stands alone (no first mapping exists) the problem is there.

Ralf

Astrato.io Head of R&D
johnw
Champion III
Champion III

It definitely looks like a bug, but I can see what's happening. It appears that specifying a map for D, DH and DP causes everything between DH and DP to lose the D mapping. This can be clearly seen in the attached example. It's as if QlikView has internally decided that DH and DP define a range, rather than just being specific values. It's like it's doing this:

if character is D

remove D

if character between H and P

if character = H

remove H

insert DH map charcters

else

if character = P

remove P

insert DP map characters

end if

end if

else

insert D map characters

end if

end if

Which is completely wrong. Would you like to report this to QlikView? Would you like me to?