Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
siem
Partner - Contributor II
Partner - Contributor II

How to load 3 tables with variables and dates

Hello, I got this script  :

// Set variables for the date range
LET vStartDate = '2020/01/01';
LET vEndDate = '2020/01/03';

// Loop through the date range and create a QVD file for each day
FOR vDate = $(vStartDate) TO $(vEndDate)
LET vDateString = Num(Date#($(vDate),'YYYY/MM/DD'));
SalesData:
LOAD *
FROM [lib://Google_Drive - abcd@gmail.com/Zu3QCj1hfhyB/stocks_$(vDateString).xlsx];

NEXT

 

MY FILES ARE : 

stocks_2020/01/01.xlsx

stocks_2020/01/02.xlsx

stocks_2020/01/03.xlsx

....

I would like load all tables for 1 year day by day.  ( I took only 3 day for the moment).

But it returns me no results

Thanks in advance

 

Labels (2)
1 Solution

Accepted Solutions
Kushal_Chawda
MVP
MVP

@siem  try below

// Set variables for the date range
LET vStartDate = floor(makedate(2020,01,01)); // year,month,day
LET vEndDate = floor(makedate(2020,01,03));

Data:
LAOD 0 as Tmp
autogenerate 0;

// Loop through the date range and create a QVD file for each day
FOR vDate = $(vStartDate) TO $(vEndDate)

LET vDateString = text(Date('$(vDate)','YYYY/MM/DD'));

concatenate(Data)
LOAD *
FROM [lib://Google_Drive - abcd@gmail.com/Zu3QCj1hfhyB/stocks_$(vDateString).xlsx];

NEXT

drop field Tmp;

View solution in original post

3 Replies
Kushal_Chawda
MVP
MVP

@siem  try below

// Set variables for the date range
LET vStartDate = floor(makedate(2020,01,01)); // year,month,day
LET vEndDate = floor(makedate(2020,01,03));

Data:
LAOD 0 as Tmp
autogenerate 0;

// Loop through the date range and create a QVD file for each day
FOR vDate = $(vStartDate) TO $(vEndDate)

LET vDateString = text(Date('$(vDate)','YYYY/MM/DD'));

concatenate(Data)
LOAD *
FROM [lib://Google_Drive - abcd@gmail.com/Zu3QCj1hfhyB/stocks_$(vDateString).xlsx];

NEXT

drop field Tmp;
siem
Partner - Contributor II
Partner - Contributor II
Author

thanks, it works;  can you explain me what does floor(makedate) pls ?

Kushal_Chawda
MVP
MVP

@siem  makedate function is used to create a date from individual year, month, day value. This makes date value in actual date format. Floor used to convert date to number format using which we can run the loop.