Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Customer & Partners, DEC. 9, 11 AM ET: Qlik Product & Strategy Roadmap Session: Data Analytics REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
sumanta12
Creator II
Creator II

Loop issue

Hi All,

I have a data like below:

DateName
17-Aug-2020Phillip Summers
18-Aug-2020Quamar Tran
19-Aug-2020Daquan Gray
20-Aug-2020Nasim Rodriguez
21-Aug-2020Ryder Bryant
22-Aug-2020Galvin Hays
23-Aug-2020Austin Navarro
24-Aug-2020Dieter Padilla
25-Aug-2020Nissim Vargas
26-Aug-2020Calvin Rosales
27-Aug-2020Lance Hensley
28-Aug-2020Ethan Odonnell
29-Aug-2020Oscar Harmon
30-Aug-2020Ira Moore
31-Aug-2020James Mitchell

 

Now I want to load data for each date and store it in each qvd and I have written the below script:

TMP_TABLE:
LOAD
DATE(Date,'DD-MMM-YYYY') AS Date,
Name
FROM
[C:\Users\smandal\Downloads\Test.xls]
(biff, embedded labels, table is Worksheet$);

FOR i =0 TO (NOOFROWS('TMP_TABLE')-1)

LET v_data = PEEK('Date',i,'TMP_TABLE');

NOCONCATENATE
TABLE:
LOAD * RESIDENT TMP_TABLE
WHERE Date = '$(v_data)';

STORE TABLE INTO C:\Users\smandal\Downloads\$(v_data)_TEST.QVD(QVD);

NEXT i

 

But it is not working. The code is generating qvd from 17-Aug-2020 to 31-Aug-2020 but data in the qvd is same for all.

 

Please help.

Labels (4)
1 Solution

Accepted Solutions
Kushal_Chawda

try below

TMP_TABLE:
LOAD distinct 
floor((Date) AS Date,
Name
FROM
[C:\Users\smandal\Downloads\Test.xls]
(biff, embedded labels, table is Worksheet$);

FOR i =0 TO (NOOFROWS('TMP_TABLE')-1)

LET v_data = PEEK('Date',i,'TMP_TABLE');

LET v_data_format = date(PEEK('Date',i,'TMP_TABLE'),'DD-MMM-YYYY');

NOCONCATENATE
TABLE:
LOAD * RESIDENT TMP_TABLE
WHERE floor(Date) = '$(v_data)';

STORE TABLE INTO C:\Users\smandal\Downloads\$(v_data_format)_TEST.QVD(QVD);

DROP Table TABLE;

NEXT i

View solution in original post

1 Reply
Kushal_Chawda

try below

TMP_TABLE:
LOAD distinct 
floor((Date) AS Date,
Name
FROM
[C:\Users\smandal\Downloads\Test.xls]
(biff, embedded labels, table is Worksheet$);

FOR i =0 TO (NOOFROWS('TMP_TABLE')-1)

LET v_data = PEEK('Date',i,'TMP_TABLE');

LET v_data_format = date(PEEK('Date',i,'TMP_TABLE'),'DD-MMM-YYYY');

NOCONCATENATE
TABLE:
LOAD * RESIDENT TMP_TABLE
WHERE floor(Date) = '$(v_data)';

STORE TABLE INTO C:\Users\smandal\Downloads\$(v_data_format)_TEST.QVD(QVD);

DROP Table TABLE;

NEXT i

View solution in original post