Skip to main content
Announcements
Qlik Community Office Hours, March 20th. Former Talend Community users, ask your questions live. SIGN UP
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Creating calendar

Hello All,

I am trying to create a calendar , but it throws error basically it is not able to capture the date inside the variable vMinDate and vMaxDate. However if i do $(vMindate) and $(vmaxDate) it returns the date appropriately.

Capture.PNG

set vMinDate = date(min(date_va));

set vMaxDate = date(max(date_va));

test:

LOAD * INLINE [

    id, date_va

    1, 02/11/2015

    2, 03/23/2016

    3, 11/20/2016

    4, 09/22/2017

    5, 05/22/2012

];

tempcalendar:

load

  $(vMinDate)  +IterNo()-1 as strtDateNum,

     $(vMinDate) +IterNo()-1 as startdate

     AutoGenerate 1

     while $(vMinDate)  + IterNo()-1 <= $(vMaxDate);

12 Replies
karthiksrqv
Partner - Creator II
Partner - Creator II

Hi,

It seems to be working as expected, could you elaborate on what it is that you are looking for?

Anonymous
Not applicable
Author

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 .

my scipt

set vMinDate = date(min(date_va));

set vMaxDate = date(max(date_va));

but when i reload it shows error  as shown in question

IMG 1

Capture.PNG

Anil_Babu_Samineni

May be date_va is the field is not working for you

Can you check in Text box -- =$(vMinDate)

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
karthiksrqv
Partner - Creator II
Partner - Creator II

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

temp_min_table:

load

min(date_va) as test_min_date,

max(date_va) as test_max_date

resident

test;

and then

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.

Anonymous
Not applicable
Author

Capture.PNG

yes anil.using text box it work, as mentioned earlier

Anonymous
Not applicable
Author

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

karthiksrqv
Partner - Creator II
Partner - Creator II

It's just the way the Qlik syntax work. All aggregations in the script level happen via a load statement, in the chart level, they are similar to 'functions' that we can use.

PrashantSangle

Hi,

try below

set vMinDate = '=date(min(date_va))';

set vMaxDate = '=date(max(date_va))';

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Anonymous
Not applicable
Author

set vMinDate = '=date(min(date_va))';

set vMaxDate = '=date(max(date_va))';

below error

Capture.PNG