Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Attend QlikWorld 2020 and hear keynote speaker, Malcolm Gladwell. Register by February 29th to save $200. Learn More
Not applicable

Creating multiple qvd files using for loop

Hi all,

I have a huge sql database with 30 million rows, which consists of data for the past 2 months. I need to load this to qvd files and i need to create multiple qvd files according to the date, ie one file for data for a particular date.

So i used the following steps

1. Load entire data.

2. Take distinct date and store in a table

3. Run a for loop for the date and store in seperate qvd files

But my code crashes after the first iteration of the loop and the qvd fine is not created.

My code is:

LET vFilename = 'D:\a_Work\Datafiles\QVDtest\funnel_' & date(today(),'YYYY_MM_DD') & '.qvd';

TableTodaysData:

SQL SELECT  *

FROM funnelMain;

STORE TableTodaysData into $(vFilename);

LET vload = 'D:\a_Work\Datafiles\QVDtest\funnel_*' & '.qvd';

Tables:

LOAD Distinct cdate as Tablenames

FROM $(vload)

(qvd);

Let vTablecount = NoOfRows('Tables');

LET vsplitFilename = 'D:\a_Work\Datafiles\QVDtest\split\funnelsplit_';

SUB LoadTableData

  For i=0 To $(vTablecount)-1

  Let vTablename = Peek('Tablenames',$(i),'Tables');

  

  Dummy:

  NoConcatenate

  Load * FROM $(vload)(qvd) Where cdate='$(vTablename)';

  STORE Dummy into $(vsplitFilename)$(vTablename).QVD;

  DROP Table Dummy;

  NEXT i

End Sub;

Call LoadTableData;

DROP Table Tables;

Please help me out.

1 Reply
Highlighted
Not applicable

Re: Creating multiple qvd files using for loop

Hi Arjun,

Hope all is well. Did you get an answer to your problem?