Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Peony
Creator III
Creator III

Using of MapSubstring for particular part of the string

Hi all.

I  have  two tables and need to compare data between. I'm doing the next steps.

1. Taking field from the catalog. 

Preload:
Load Prefix
From catalog.qvd (qvd);


MapPrefix:
Mapping LOAD
Prefix,
'/'& Prefix &'\'
Resident Preload;

2. Next step I'm loading data to compare and using MapSubstring to get the result of compare.  

Calls:
Load *,
TextBetween(MapSubString('MapPrefix' , ValueToCompare), '/', '\') as Result

From ValueToCompare.qvd (qvd);

3. As the result table I received something like that:

PrefixValueToCompare
506650662911
50665066297
5066506639
506750671268888
506750671388888
506850683391369
5068506838684
795244202579
84585258884587

 

And last two rows show me not that result that I need. The thing is that compare should be applied only at the beginning of the ValueToCompare, not in the middle or in the end. 

And I don't understand how to apply comparison only for beginning of the value? 

Labels (2)
1 Solution

Accepted Solutions
sunny_talwar

Try something like this

MapPrefix:
Mapping
LOAD '@' & Prefix,
	 '/'& Prefix &'\';
LOAD * INLINE [
    Prefix
    5066
    5066
    5066
    5067
    5067
    5068
    5068
    79
    845
];

Calls:
LOAD *,
	 TextBetween(MapSubString('MapPrefix' , '@' & ValueToCompare), '/', '\') as Result;
LOAD * INLINE [
    ValueToCompare
    50662911
    5066297
    506639
    50671268888
    50671388888
    50683391369
    506838684
    5244202579
    5258884587
];

View solution in original post

2 Replies
sunny_talwar

Try something like this

MapPrefix:
Mapping
LOAD '@' & Prefix,
	 '/'& Prefix &'\';
LOAD * INLINE [
    Prefix
    5066
    5066
    5066
    5067
    5067
    5068
    5068
    79
    845
];

Calls:
LOAD *,
	 TextBetween(MapSubString('MapPrefix' , '@' & ValueToCompare), '/', '\') as Result;
LOAD * INLINE [
    ValueToCompare
    50662911
    5066297
    506639
    50671268888
    50671388888
    50683391369
    506838684
    5244202579
    5258884587
];
Peony
Creator III
Creator III
Author

Great idea, Sunny! Thank you much for it!🤗