Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
See the example below:
Sub Mappings
Codesmap:
Mapping LOAD * Inline [
Code, Description
01, Code 01
02, Code 02
03, Code 03
];
End Sub
Call Mappings;
Table1:
Load
Field1,
Applymap('Codesmap',Field1) as CodeDescription,
Field2,
Field3
FROM
[Stuff.xlsx]
(ooxml, embedded labels, table is StuffData);
 Peter_Cammaert
		
			Peter_Cammaert
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		
QlikView has no real concept of scope, ...
For tables and fields that may be true. But don't be mistaken: SUBs have a very strict concept of scope. And so do loops. All of them.
 
					
				
		
 tomasz_tru
		
			tomasz_tru
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Do you have any problems with that script? It should be working.
Tomasz
 
					
				
		
My script is more complex than the one I used as an example. Let me check my script again.
Thanks Tomasz.
 marcus_malinow
		
			marcus_malinow
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi Pablo,
QlikView has no real concept of scope, so yes, that would work just fine.
The only proviso, is that obviously you must create your mapping table prior to referencing it!
Marcus
 Peter_Cammaert
		
			Peter_Cammaert
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		
QlikView has no real concept of scope, ...
For tables and fields that may be true. But don't be mistaken: SUBs have a very strict concept of scope. And so do loops. All of them.
 
					
				
		
Do you mean that a mapping table created in SUB cannot be used outside the SUB?
 marcus_malinow
		
			marcus_malinow
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		I stand corrected! Thanks for the clarification Peter
 
					
				
		
I've done this test:
Sub Mappings
Codesmap:
Mapping LOAD
Code, Description
     FROM 
End Sub
Call Mappings();
Table1:
LOAD
Field1,
Applymap('Codesmap',Field1, 'NO MAP') as CodeDescription,
Field2,
Field3
FROM 
And it works without problems.
Thanks for your help
