Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
archire2102
Partner - Contributor III
Partner - Contributor III

Mapping with a table using wildcards

Hi,

Below is my mapping table:

Class ID
AAASCE002
AAASTE004
CARsE00301

 

and here is the main table:

Field1 ID
1E002846ghdsb
3E004fdfghrj
7E00301fhetj

 

How can I apply map to the second table? 

 

1 Solution

Accepted Solutions
agni_gold
Specialist III
Specialist III

Use this : 

 

Table1:
Load * , len(trim(ID)) as IDLenght;
LOAD * INLINE [
Class, ID
AAASC, E002
AAAST, E004
CARs, E00301
];

Source:
LOAD * INLINE [
Field1, ID
1, E002846ghdsb
3, E004fdfghrj
7, E00301fhetj
];


For i=0 to NoOfRows('Table1')-1
Let vID = Peek('ID',$(i),'Table1');
Let vClass = Peek('Class',$(i),'Table1');

Final:
Load * , if(WildMatch(ID, '*$(vID)*'),'$(vID)') as CorrectID ,'$(vClass)' as Class Resident Source;
Next;

DROP Tables Table1,Source;

View solution in original post

5 Replies
vardhancse
Specialist III
Specialist III

Hi,

 

Try like some thing below:

Applymap('Map',Left(ID,4)) as New

or

If we have a delimiter like ';' or '|', it will be very easy like using subfield (ID,';')

agni_gold
Specialist III
Specialist III

Use this : 

 

Table1:
Load * , len(trim(ID)) as IDLenght;
LOAD * INLINE [
Class, ID
AAASC, E002
AAAST, E004
CARs, E00301
];

Source:
LOAD * INLINE [
Field1, ID
1, E002846ghdsb
3, E004fdfghrj
7, E00301fhetj
];


For i=0 to NoOfRows('Table1')-1
Let vID = Peek('ID',$(i),'Table1');
Let vClass = Peek('Class',$(i),'Table1');

Final:
Load * , if(WildMatch(ID, '*$(vID)*'),'$(vID)') as CorrectID ,'$(vClass)' as Class Resident Source;
Next;

DROP Tables Table1,Source;

jonathandienst
Partner - Champion III
Partner - Champion III

Rob Wunderlich created a great example of this type of wildcard mapping in his Qlikview Cookbook. Have a look here:

http://qlikviewcookbook.com/list-recipes/

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
archire2102
Partner - Contributor III
Partner - Contributor III
Author

Thanks Vardhan but the field length is not fixed so we cannot use Subfield or left. 😞

archire2102
Partner - Contributor III
Partner - Contributor III
Author

Thanks for the solution 🙂