Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
May 18th 10AM ET, Live Chat, bring your QlikView questions. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
sudhakaran_abha
Creator
Creator

Assigning dynamic table name in For Loop

Hi,

Is it possible to assign dynamic tables based on changing numeric values in the for loop ?

Please refer to the sample code below:

For i = 1 to 12

TableName & $(i):

LOAD *

RESIDENT

Next i;

1 Solution

Accepted Solutions
tamilarasu

Hi Sudhakaran,

Yes. We can assign dynamic table names. Check the below script.

For i = 1 to 4

Qualify '*';

[TableName $(i)]:

Load

  AddMonths(today(),12) - recno() AS Date

Autogenerate (AddMonths(today(),12) - MakeDate(2016,01,01));

Next i;

Capture.PNG

View solution in original post

3 Replies
tamilarasu

Hi Sudhakaran,

Yes. We can assign dynamic table names. Check the below script.

For i = 1 to 4

Qualify '*';

[TableName $(i)]:

Load

  AddMonths(today(),12) - recno() AS Date

Autogenerate (AddMonths(today(),12) - MakeDate(2016,01,01));

Next i;

Capture.PNG

View solution in original post

Kush
MVP
MVP

what do you mean by assigning dynamic table name? what is requirement? why you want to do that?

sudhakaran_abha
Creator
Creator
Author

Hi Kushal,

There are multiple reasons why this approach is needed:

1. To load separate monthly tables, and load them into separate QVDs

2. Avoid the recursive load of all data to be concatenated into a single table.

2. Process data for different months differently (this is where it is easier when we have different table names for each month)

Hope this helps.