Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
erikzions
Contributor

Can I reuse mapping tables

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

Tags (1)
1 Solution

Accepted Solutions
cheburashka
Contributor III

Re: Can I reuse mapping tables

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

2 Replies
Not applicable

Re: Can I reuse mapping tables

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.

cheburashka
Contributor III

Re: Can I reuse mapping tables

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

Community Browser