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

Mapping load with more than one values

Hi All,

Dept:

Mapping  Load * Inline [

DeptID, Location

10,     200

10,     100

];

Emps:

Load *,

ApplyMap('Dept',DeptID) as Location;

Load * Inline [

EmployeeID, DeptID

1213, 10

];

When I reload I am getting a single record in Emps table with the first match ie 200, is there a way to get two records in the EMps table

as

1213, 10, 200

1213, 10, 100

I can get it with joins but the situation is different with real data.

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Mapping Load
     
DeptID,
     Concat(Location,'|') as List
Inline [
DeptID, Location
10,     200
10,     100
]
Group by DeptID ;

Emps:
Load
     EmployeeID,
     subfield(ApplyMap('Dept',DeptID),'|') as Location
Inline [
EmployeeID, DeptID
1213, 10
]
;


talk is cheap, supply exceeds demand

View solution in original post

11 Replies
Gysbert_Wassenaar

Well, yes you could concatenate the values in the mapping table and then use the subfield function to create separate records again for each value in the list. But you should just use a join instead.


talk is cheap, supply exceeds demand
Anil_Babu_Samineni

Perhaps This

Dept:

LOAD * INLINE [

DeptID, Location

10, 200

10, 100

];

Join

Load * Inline [

EmployeeID, DeptID

1213, 10

];

Note: Real data, What you are facing?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
kkkumar82
Specialist III
Specialist III
Author

Can you give the script ??

avinashelite

Try like this

Dept:

Load * Inline [

DeptID, Location

10,     200

10,     100

];

T:

Mapping LOAD DeptID,

Concat(Location,',') as L

resident

Dept

group by

DeptID;

Emps:

Load *,

ApplyMap('T',DeptID) as Location;

Load * Inline [

EmployeeID, DeptID

1213, 10

];

sunny_talwar

I agree, one way could be to do a left join. But what exactly are you trying to do?

Gysbert_Wassenaar

Mapping Load
     
DeptID,
     Concat(Location,'|') as List
Inline [
DeptID, Location
10,     200
10,     100
]
Group by DeptID ;

Emps:
Load
     EmployeeID,
     subfield(ApplyMap('Dept',DeptID),'|') as Location
Inline [
EmployeeID, DeptID
1213, 10
]
;


talk is cheap, supply exceeds demand
florentina_doga
Partner - Creator III
Partner - Creator III

try this

final:

Load * Inline [

EmployeeID, DeptID

1213, 10

];

left join (final)

LOAD * INLINE [

DeptID, Location

10, 200

10, 100

];

kkkumar82
Specialist III
Specialist III
Author

Joining is the ultimate but we are insisted not to do a join till last try, as they are all transaction tables with huge data

sunny_talwar

With large data, it makes sense to not use joins. Use what Gysbert has proposed then.