Vision - Popup Calendar reset to now()

Hi all,

I currently have an easy chart that looks at two popup calendars for Start and End date.

I want the users to be able to use the Chart’s Range selector along with the calendars.

The issue I’m facing is:

I defined the End date calendar’s time to now(300000) and so whenever I’m trying to see values from say two days ago, it resets the end date to now(300000) after 5 min.

I tried scripting but I believe it’s not possible to pass the poll rate and so it takes the time when the script ran and won’t refresh automatically.

Is there any way I can setup a reset end date button so that it sets current time with a poll rate I specify instead of changing chart’s mode to Realtime?

If I understand what your looking for, you want to be able to set the poll rate on the screen? To do that I wouldn’t try to do it on the calendar, I’d use a timer script and have it write the date to the calendar when the timer completes. Doing it there, you can also add a script to your start and end date calendars to reset the time when the user changes the date/time range so it will refresh from the last change. You can also enable or disable the timer to keep it from timing if the user manually changes the date/time if you wanted.

Hi @bpreston - not really the poll rate on the screen but of the now() expression that I want to pass to the End date calendar only.

For example: In the current setting - If a user wants to see data from May 11- May 12th, after 5 minutes, it sets the end date to now() - so May 19th and user is now looking at data from May 11 - May 19th.

I just want to be able to pass a now() expression to the End date calendar from a button so that user can now look at data with whatever Start date they specified to the now().

Use some expression language at date prop of popup calendars

if({Root Container.Easy Chart.chartMode}=2, //2=realtime

if you set the easy chart to realtime it should autorefresh each 5 mins else just poll 1 time the current date.

Two things, are you wanting it to poll the end date or just update it when you press a button. If you want it to update it when you press a button then you can’t do that through an expression. You would have to do it through a python script in the action performed section. If you just want your end date to poll then you can do an expression on the date in your popup calendar for it to poll with the now(300000). If you don’t want it to poll then you can use now(0) so that it updates when the page first loads but doesn’t poll a new date. The start and end I would expect to be separate from each other so one updating shouldn’t impact the other.

Thanks @jespinmartin1 for the expression. Maybe I have to use modes to get what I want.

Preferably I just want to use only History mode:

When the window is first opened, the Start date is addHours(now(300000),-24) and end date is now(300000). I want it to stop polling when a user interacts with the slider and /or selects their own start and end date calendars (they are currently linked and bidirectional is enabled).

When the user is done checking old data and wants to reset the dates to see live data again by using a button - I want it to start polling - basically reset the start date to addHours(now(300000),-24) and end date to now(300000) - just like how it was when the window first opened.

Use expression bindings with now(0), as @bpreston suggested. That evaluates at startup, just once. No updates. That let’s your users manipulate the historical range without interference.

Then, in your reset pushbuttion, use system.db.refresh() to tell the original bindings to execute again. I don’t recommend polling when users can interact with the result.

Thank you all for your replies. I implemented it a little differently:

  1. I created a drop-down menu with two options -

    • Current
    • Select Time/Date
  2. I created a custom property called nowTime with an expression:

if({Root Container.Filter.Dropdown.selectedIndex}=0,now(),{Root Container.Filter.Popup Cal})
  1. I put a hide/show expression on the End date calendar so that it only shows up when a user selects ‘Select Time/Date’ option from the drop down menu. I also linked End date value to nowTime custom property - not bidirectionally.

When I select Current, it resets End date to current time and I can see Realtime data again. I’m planning to use this dropdown and implement the same for Start date as well.