Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 kkkumar82
		
			kkkumar82
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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.
 Gysbert_Wassena
		
			Gysbert_WassenaMapping 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
]; 
 Gysbert_Wassena
		
			Gysbert_WassenaWell, 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.
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?
 kkkumar82
		
			kkkumar82
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Can you give the script ??
 
					
				
		
 avinashelite
		
			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
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		I agree, one way could be to do a left join. But what exactly are you trying to do?
 Gysbert_Wassena
		
			Gysbert_WassenaMapping 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
]; 
 
					
				
		
 florentina_doga
		
			florentina_doga
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		try this
final:
Load * Inline [
EmployeeID, DeptID
1213, 10
];
left join (final)
LOAD * INLINE [
DeptID, Location
10, 200
10, 100
];
 kkkumar82
		
			kkkumar82
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		With large data, it makes sense to not use joins. Use what Gysbert has proposed then.
