Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2022, LIVE in Denver CO., May 16-19, 2022. REGISTER NOW TO RECEIVE EARLY BIRD PRICING
cancel
Showing results for 
Search instead for 
Did you mean: 
vignesh_s
Creator
Creator

hi

can any1 explain the below expresion

let varMinDate=Num(Peek('OrderDate',0,'Order'));

let varMaxDate=Num(peek('OrderDate',-1,'Order'));

let Vartoday=Num(today());

DateField:

LOAD

$(VarMinDate)+rowno()-1 as Num,

Date($(varMinDate)+RowNo()-1) as tempdate

AutoGenerate

$(varMaxDate)-$(varMinDate)+1;

1 Solution

Accepted Solutions
stabben23
Master
Master

Hi, some input here, lets pretend that Your OrderDate is from 2017/01/01 to 2017/12/31

$(VarMinDate)+rowno()-1 as Num, //this will use Your variable VarMinDate as a numeric value and plus the number of rowno(), in this case 0

ex 42736

Date($(varMinDate)+RowNo()-1) as tempdate //This do the same as above but create a date format ex 2017/01/01

AutoGenerate

$(varMaxDate)-$(varMinDate)+1  //this will autogenerate rows, in Your case 43100-42736=364+1, which is Your OrderDates

43100 is 2017/12/31

So this will create a calendar for you With Your OrderDate, important as Thomasz says: Order table need to be sorted asc as you use peek

View solution in original post

5 Replies
tomasz_tru
Specialist
Specialist

There must be Order table with OrderDate field, Zero in peek means it gets first OrderDate value, -1 means it takes last one. Then it generated dates between, but I would check if OrdreDate is sorted.

vignesh_s
Creator
Creator
Author

thanks

can u explain this part

$(VarMinDate)+rowno()-1 as Num,

Date($(varMinDate)+RowNo()-1) as tempdate

AutoGenerate

$(varMaxDate)-$(varMinDate)+1 

johnhhtp2
Creator II
Creator II

without data it will be difficult to the members to help you out, please take some time to provide sample data if possible.

stabben23
Master
Master

Hi, some input here, lets pretend that Your OrderDate is from 2017/01/01 to 2017/12/31

$(VarMinDate)+rowno()-1 as Num, //this will use Your variable VarMinDate as a numeric value and plus the number of rowno(), in this case 0

ex 42736

Date($(varMinDate)+RowNo()-1) as tempdate //This do the same as above but create a date format ex 2017/01/01

AutoGenerate

$(varMaxDate)-$(varMinDate)+1  //this will autogenerate rows, in Your case 43100-42736=364+1, which is Your OrderDates

43100 is 2017/12/31

So this will create a calendar for you With Your OrderDate, important as Thomasz says: Order table need to be sorted asc as you use peek

View solution in original post

vignesh_s
Creator
Creator
Author

Thank you so much,it helped to me to understand in right manner