How to properly set Date in calendar

Hi guys,

I’m trying to set a couple of calendars in order to use them as “From - Until” selector for a report. I made them work with the report but I have a problem with the Date property. I want to automatically set the Date from the calendars to now and to 1 day before now but also I need to let the users change that range if they want and there is where I have the problem.
I tried to bind calendar’s property Date(immediate and latched) to now() but that doesn’t allow me to change the selected day, when I try to change the calendar’s time it returns automatically to now() in this case.
Can you give a hint here? I thing that I might set the date using scripting doing something like event.source.date = now() but I’m not sure how to do it or how to call the date object in jython.

Thanks
Manuel

Not sure about proper but what I do is:

On the calendar make a custom property called “Today” set to date.
On the property for this set it to “Now()”

Then on the internalframeactivated event for the window I use the set property event and set the calendar date to the “Today” custom property.

Every time window is opened it gets set to today but is changeable.

1 Like

Hi

What I do is create date SQL tags for start date and end date so to solve your problem I would set the end date to now and the start date to 1 day before now using date arithmetic function. Then bind these tags to the date immediate on your two calender components. Your calender will always open with the SQL tag values and also allow changing them to whatever the user wants. Make sure to keep bidirectional unchecked when binding to calender component or it will update with SQL values

Aidan

Thanks guys,

I finally solved my problem doing what AxisIt suggested. I couldn’t do it in the other way, I might missed something.

Thank you again!
:thumb_left: