Discussion Board for collaboration on QlikView Scripting.
This is probably a simple concept but I am not all that familiar with loops. Basically I have the following in a table, say with a date from 01/01/2013 through today 10/30/2014.
I would like to loop through and create a QVD for each date from 06/30/2014 and forward. What's the best way to do this?
The logic must be something like:
For i = 1 to number of rows of the table (Look for NoofRows() function)
Select * from MyTable where myDateField = $(myDate);
Store * from MYTAB INTO mytab_$(myDate).qvd;
drop table MYTAB;
Let me know
Hello Mark, Please find the below:
LOAD Reported_Date, Value From source_table :
LET vRows =
FOR i=1 to FieldValueCount('Reported_Date')
LET vDate = FieldValue( 'Reported_Date', $(i) );
LOAD * FROM ..(ur statement)
STORE QVDNAME_$(vDate) FROM QVDNAME_$(vDate).qvd (qvd) ;
DROP Table QVDNAME_$(vDate):
Hi Alessandro - thanks for your response. I receive the following errors and am not sure why. It appears QV is having trouble understanding the variable $(vDate) in the where clause.
Field not found - <=>
LOAD * RESIDENT Data where [REPORTED_DATE]=
For i = 1 to NoOfRows(Data)
LOAD * RESIDENT Data where [REPORTED_DATE]=$(vDate);
Store MyTable into [DailyStats_$(vDate).qvd](qvd);
Drop Table MyTable;
use peek function.
For i = 1 to NoOfRows(MyTable)
verify (with a text box that NoOfRows(MyTable) returns the right number