Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for
Did you mean:
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:

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

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

AutoGenerate

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

1 Solution

Accepted Solutions
Partner - 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

5 Replies
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.

Creator
Author

thanks

can u explain this part

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

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

AutoGenerate

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

Anonymous
Not applicable

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

Partner - 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

Creator
Author

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

Community Browser