Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

variables meaning

Hi All,

Good Morning ,

Can any one plz explain me in detail what does the below script excatly means ? and how does it works .

LET vMinDate = num(MakeDate(2014, 1));
LET vMaxDatenum(MakeDate(2014, 1, 31));
LET vCount = 0;

Directory; //Current directory

//------------------- Temporary Calendar -------------------
TempCalendar:
LOAD
$(vMinDate)+IterNo()-1 AS Num,
Date($(vMinDate)+IterNo()-1,'DD.MM.YYYY') AS TempDate
AUTOGENERATE 1 WHILE ($(vMinDate)+IterNo()-1) <= $(vMaxDate);
//----------------------------------------------------------

//------------FOR loop to load the excel files in a sequence----------
FOR a = 0 to NoOfRows('TempCalendar')-1

LET vFilename = text(peek('TempDate',$(a),'TempCalendar'));


Thanks in Advance

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi Wrestler,

Here is in detail.

LET vMinDate = num(MakeDate(2014, 1)); //creates a number representation for 1st Jan 2014 and assign number value for vMinDate as 41640
LET vMaxDatenum(MakeDate(2014, 1, 31));//creates a number representation for 31st dec 2014 and assign number value for vMaxDate as 42004
LET vCount = 0;

Directory; //Current directory

//------------------- Temporary Calendar -------------------

Below part generates calendar table for 2014 with first column as number representation of date and 2nd clolumn as date representation of 365 days of 2014.
TempCalendar:
LOAD
$(vMinDate)+IterNo()-1 AS Num,
Date($(vMinDate)+IterNo()-1,'DD.MM.YYYY') AS TempDate
AUTOGENERATE 1 WHILE ($(vMinDate)+IterNo()-1) <= $(vMaxDate);
//----------------------------------------------------------

//------------FOR loop to load the excel files in a sequence----------

this is just to create text representation of each date and assign the value of each date into VFileName varable. vFileName variable must be used as part of the file names to differentiate each file for every single date
FOR a = 0 to NoOfRows('TempCalendar')-1

LET vFilename = text(peek('TempDate',$(a),'TempCalendar'));

Hope this helps.


BR,

chinna

View solution in original post

5 Replies
jyothish8807
Master II
Master II

Hi Wrestler,

This is a script to create a master calendar between two dates ( MinDate and MaxDate).

in Vmindate we are storing date '1/1/2014' and in vMaxdate we are storing the date '1/31/2014'

after that using an iterno() function we are auto generating all the dates between the min and max date.

Hope it helps.

Regards

KC

Best Regards,
KC
vardhancse
Specialist III
Specialist III

MakeDate(2014, 1) will create date with given attributes like: 01/01/2014


MakeDate function will be used to create date


syntax: MakeDate(2014) if only year was given it will take 1st month of year and 1st date of month

mangalsk
Creator III
Creator III

hi

LET vMinDate = num(MakeDate(2014, 1));

it will assing vMinDate =2014/1/1


LET vMaxDatenum(MakeDate(2014, 1, 31))

it will assing vMaxDate =2014/1/31



TempCalendar:
LOAD
$(vMinDate)+IterNo()-1 AS Num,
Date($(vMinDate)+IterNo()-1,'DD.MM.YYYY') AS TempDate
AUTOGENERATE 1 WHILE ($(vMinDate)+IterNo()-1) <= $(vMaxDate);



This code will generate dates between 2014/1/1 and 2014/1/31



FOR a = 0 to NoOfRows('TempCalendar')-1

LET vFilename = text(peek('TempDate',$(a),'TempCalendar'));

This will now assign each date to vFilename.


I feel files names are given as date and for loop is used to load data from these files automatically through loop



Thanks and Regards,

Mangal





Anonymous
Not applicable
Author

Hi Wrestler,

Here is in detail.

LET vMinDate = num(MakeDate(2014, 1)); //creates a number representation for 1st Jan 2014 and assign number value for vMinDate as 41640
LET vMaxDatenum(MakeDate(2014, 1, 31));//creates a number representation for 31st dec 2014 and assign number value for vMaxDate as 42004
LET vCount = 0;

Directory; //Current directory

//------------------- Temporary Calendar -------------------

Below part generates calendar table for 2014 with first column as number representation of date and 2nd clolumn as date representation of 365 days of 2014.
TempCalendar:
LOAD
$(vMinDate)+IterNo()-1 AS Num,
Date($(vMinDate)+IterNo()-1,'DD.MM.YYYY') AS TempDate
AUTOGENERATE 1 WHILE ($(vMinDate)+IterNo()-1) <= $(vMaxDate);
//----------------------------------------------------------

//------------FOR loop to load the excel files in a sequence----------

this is just to create text representation of each date and assign the value of each date into VFileName varable. vFileName variable must be used as part of the file names to differentiate each file for every single date
FOR a = 0 to NoOfRows('TempCalendar')-1

LET vFilename = text(peek('TempDate',$(a),'TempCalendar'));

Hope this helps.


BR,

chinna

Not applicable
Author

hi Chinna,

Thanks for ur detail explanation , People like u should be there in IT to encourage Fresher ,thanks once again.

Good regards

Wrestler