Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Live chat with experts, bring your API Integration questions. June 15th, 10 AM ET. REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
rakesh_kumar
Creator
Creator

For loop to generate data

Hi Guys,

I am trying to create a table with data as follows:

For 1=1 to 1000000

NewTable:

Load $(i) as Counter

AutoGenerate 1;

NEXT

When the above code is executed its taking nearly 20 minutes to create a table with 1 million rows. Is there any other efficient way of modifying code to reduce the time taken for the creation of the above table?

Thanks,

RK

1 Solution

Accepted Solutions
petter
MVP
MVP

LOAD

     RecNo() AS Counter

AUTOGENERATE

     1000000;

View solution in original post

5 Replies
petter
MVP
MVP

LOAD

     RecNo() AS Counter

AUTOGENERATE

     1000000;

View solution in original post

rakesh_kumar
Creator
Creator
Author

Hi Petter,

Thanks for the code and Its very fast now.

Please can you tell why the looping is so slow compared to your approach?

Thanks,

RK

ToniKautto
Employee
Employee

Petter's example generates ONE load statement that contains one million rows.

In your original example you generate 1 million load statements, which then  are concatenated into one common table.

Your approach simply adds an enormous amount of processing overhead.

Not applicable

Hi Rakesh,

Try like this:

LOAD

     RecNo() AS ID

AUTOGENERATE

     n;

Ramaya.

rakesh_kumar
Creator
Creator
Author

Thanks Toni for the simple and easy to understand explanation