Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
Hi, for the second calendar you could use
monthend (today(), -1 )
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!
you could try =today()-2
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)))
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.
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?
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
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
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)