Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikwiz123
Creator III
Creator III

Lookup into multiple tables

I have three tables

Source:                                                        

NameIDRegion
A1ASIA
B4ASIA
C5NA
D7EMEA
E9ASIA
F2ASIA
G5EMEA
H8EMEA
I NA
J ASIA
K NA
L ASIA
M EMEA
N EMEA

 

Category:

NameCategoryID
A4
B5
C9
D3
E6
F1
G0
H8
I2
J7
K10
L23
M65
N12
O66
P54
Q35
R87
S98
T67
U23
V11
W70
X30
Y29
Z36

 

Property:

CategoryIDID
451
964
915
887
629
992
195
558
271
773
1072
2375
6549
1259

 

I need to fill the values for 'ID' in table 'Source' by looking into 'Category' and 'Property Tables'

In plain English, I should use 'Name' from Source table and look into Category table, use the CategoryID to get relevant 'ID' values from Property table and populate the Source Table as below:

Result Table: Source:

NameIDRegion
A1ASIA
B4ASIA
C5NA
D7EMEA
E9ASIA
F2ASIA
G5EMEA
H8EMEA
I71NA
J73ASIA
K72NA
L75ASIA
M49EMEA
N59EMEA

 

Help to achieve this is greatly appreciated as I am trying ApplyMap, Left Join etc for days now but not able to do this 🙂

Labels (4)
1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this.

Category:
Mapping Load * inline [
Name, CategoryID
A, 4
B, 5
C, 9
D, 3
E, 6
F, 1
G, 0
H, 8
I, 2
J, 7
K, 10
L, 23
M, 65
N, 12
O, 66
P, 54
Q, 35
R, 87
S, 98
T, 67
U, 23
V, 11
W, 70
X, 30
Y, 29
Z, 36
];

Property:
Mapping Load * inline [
CategoryID, ID
45, 1
96, 4
91, 5
88, 7
62, 9
99, 2
19, 5
55, 8
2, 71
7, 73
10, 72
23, 75
65, 49
12, 59
];

Source:
Load *,If(ID = '' or isnull(ID),Applymap('Property',ApplyMap('Category',Name)),ID) as NewID inline [
Name, ID, Region
A, 1, ASIA
B, 4, ASIA
C, 5, NA
D, 7, EMEA
E, 9, ASIA
F, 2, ASIA
G, 5, EMEA
H, 8, EMEA
I, , NA
J, , ASIA
K, , NA
L, , ASIA
M, , EMEA
N, , EMEA
];

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

2 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this.

Category:
Mapping Load * inline [
Name, CategoryID
A, 4
B, 5
C, 9
D, 3
E, 6
F, 1
G, 0
H, 8
I, 2
J, 7
K, 10
L, 23
M, 65
N, 12
O, 66
P, 54
Q, 35
R, 87
S, 98
T, 67
U, 23
V, 11
W, 70
X, 30
Y, 29
Z, 36
];

Property:
Mapping Load * inline [
CategoryID, ID
45, 1
96, 4
91, 5
88, 7
62, 9
99, 2
19, 5
55, 8
2, 71
7, 73
10, 72
23, 75
65, 49
12, 59
];

Source:
Load *,If(ID = '' or isnull(ID),Applymap('Property',ApplyMap('Category',Name)),ID) as NewID inline [
Name, ID, Region
A, 1, ASIA
B, 4, ASIA
C, 5, NA
D, 7, EMEA
E, 9, ASIA
F, 2, ASIA
G, 5, EMEA
H, 8, EMEA
I, , NA
J, , ASIA
K, , NA
L, , ASIA
M, , EMEA
N, , EMEA
];

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
qlikwiz123
Creator III
Creator III
Author

@kaushiknsolanki  Thank you so much, this is wonderful