Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Now accepting applications for the Qlik Luminary and Partner Ambassador Programs: Apply by July 6!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calendar Defaults

Hello

The QV calendar object is currently driving me a bit mad!

I have two instances of a calendar object in my application and I want three things:

The first calendar to be set to the current date when the user opens the application

I can do this with a trigger setting the field to =today().

The second calendar to be set to the last day of the previous month. I don't know how to do this.

Both calendars to be locked to always have one date selected. I don't want them to be cleared. There is no option for this in the properties of the calendar object. Is there another way to achieve this?

Thanks.

Labels (1)
11 Replies
bbi_mba_76
Partner - Specialist
Partner - Specialist

Hi, for the second calendar you could use

monthend (today(), -1 )

Not applicable
Author

Actuall, on reflection I think I want the first calendar to be set to the day before yesterday. Is there a way to do this?

Thanks!

bbi_mba_76
Partner - Specialist
Partner - Specialist

you could try =today()-2

Anonymous
Not applicable
Author

Be careful with monthend() - it is a timestamp, returns the last second  of the motnh: 09/30/2013 11:59:59 PM.  If you want only date, use date(floor()):

date(floor(monthend (today(), -1)))

Not applicable
Author

That doesn't work unfortunately. I've created a variable and set it to =today() and then used it in the "select in field" trigger, which works. But if I put =today()-1 it doesn't.

Not applicable
Author

Ah, found this function

date(now()-1)

Which seems to work.

My only outstanding issue is preventing the calendars being cleared. Is there a way to do this?

Anonymous
Not applicable
Author

The trigger is format-sensitive (and set analysis too).  The expression today() returns date, byt today-1 returns integer, hence "select in field" doesn't work.  Try

=date(today()-1)

Regards,

Michael

Anonymous
Not applicable
Author

Don't ever use now() on the front end, you're asking for trouble.  It will be checking time non-stop.  Use date(today()-1).  The solution is in date, not in now.

Add action "lock field" to prevent from clearing.  Apparently you'll have also to add unlock before selectiong the date:

1. unlock

2. select

3. lock

Clever_Anjos
Support
Support

It´s clearing maybe because there´s no correlation to your date.

now() returns a timestamp, you should convert to a date without time

date(floor(now())-1), which is exactly equal date(today()-1)