Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Below is my mapping table:
Class | ID |
AAASC | E002 |
AAAST | E004 |
CARs | E00301 |
and here is the main table:
Field1 | ID |
1 | E002846ghdsb |
3 | E004fdfghrj |
7 | E00301fhetj |
How can I apply map to the second table?
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;
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,';')
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;
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/
Thanks Vardhan but the field length is not fixed so we cannot use Subfield or left. 😞