Thanks karthik for prompt response.
But it dosent work it throws error, basically i was looking for a short work around creating master calendar. So if i refer (IMG 1 below i wanted in vMinDate if i can get the values calculate from within the script/ field .
set vMinDate = date(min(date_va));
set vMaxDate = date(max(date_va));
but when i reload it shows error as shown in question
These are the issues am seeing:
1. The 2 variables are referring to a field that is created after the variables are defined.
2. You cannot use date(min(date_va)) , this is how we'd use it in a chart, not in the script. In the script, you'd have to do a
min(date_va) as test_min_date,
max(date_va) as test_max_date
set vMinDate = peek('test_min_date',-1,'temp_min_table');
set vMaxDate = peek('test_max_date',-1,'temp_min_table');
You can then use the vMinDate and vMaxDate in your next reload.
Hope this helps.
yea i checked on this as an alternative i know this approach.
like we have to create a field and then load min max date in variable using peek function..
so i was being curious why can t we procees just by storing min/max in variable itself i was not confident with the reason as to why we cant do straight away..
i could also have done this
min([Order Date]) as minDate,
max([Order Date]) as maxDate
[C:\Users\kuppili.anvesh\Qlikview Practice\Source\Superstore Subset.xlsx]
(ooxml, embedded labels, table is Orders);
minDate + Iterno()-1 As Num,
Date(minDate + IterNo() - 1) as TempDate
While minDate + IterNo() -1 <= maxDate;
would it make any difference in performance if I directly accesa fields minDate,maxDate above in TempCalendar
Maybe like that:
LOAD * INLINE [
min(date_va) as minDate,
max(date_va) as maxDate
Let vMinDate = Num(Peek('minDate', 0, 'Temp'));
Let vMaxDate = Num(Peek('maxDate', 0, 'Temp'));
DROP Table Temp;
$(vMinDate) +IterNo()-1 as strtDateNum,
$(vMinDate) +IterNo()-1 as startdate
while $(vMinDate) + IterNo()-1 <= $(vMaxDate);
hope this helps!