Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a for loop in my script that loads data for each month. I would like to reuse my mapping tables for each month, loading them with the next months lookup values. In my test, the second time I assign values to the mapping table it doesn't take. So far I don't see a way to drop the table, or to use a dynamic name.
Any help on this would be appreciated.
Thanks
Hello Erik, Dathu,
Note that in the case of a loop. Mapping tables DO autoconcatenate.
I proved this using the attached qvw.
Mapping tables don't autoconcatenate when they have a different name.
The solution is to give your mapping table a different name in each step. This can be by adding a variable depending on the counter i to the name.
,KR Koen
Hi Erik , Firstly, there is no concatenation between two mapping tables. So please use global Mapping table or create Mapping table every time in the Loop like below:
Method1:
MAP_TAB:
MAPPING LOAD A, B FROM SOURCE ;
FOR i=1 to 10
LOAD * , ApplyMap('MAP_TAB',A) AS FIELD;
Next i
Method2:
FOR i=1 to 10
vMapName = 'MAP_TAB'&$(i);
$(vMAPName):
MAPPING LOAD A, B FROM SOURCE;
LOAD * , ApplyMap('$(vMapName)', A) AS FIELD ;
NEXT i
Please post your script if you encounter any problems.
Hello Erik, Dathu,
Note that in the case of a loop. Mapping tables DO autoconcatenate.
I proved this using the attached qvw.
Mapping tables don't autoconcatenate when they have a different name.
The solution is to give your mapping table a different name in each step. This can be by adding a variable depending on the counter i to the name.
,KR Koen