Calendar Component Latched red background not changing

We have a window that is used for tracking performance data and use the calendar component as the filter for the date to run queries in the window. Recently we noticed the users rarely close the window and the latched date (red background) was still on the date the user opened the window. We decided to fix this by putting a client timer script in place to check the latched vs immediate date and if they are different to refresh the latched property. The latched property has an expression for dateformat and now(0). We tested this in Designer to make sure it works, however now that we published it does not appear to be working. We know that the script executed by a print statement in the log but the red background is still on the date the window was opened on and not now. Do we also need to have the component repaint? I would think the refresh would have forced that to happen.

windows = system.gui.getOpenedWindowNames()
#print windows
if 'Line Status/Line_Status' in windows and system.util.getInactivitySeconds()>"refreshLimit").value:
	window = system.gui.getWindow('Line Status/Line_Status')
	latched = window.getRootContainer().getComponent("Calendar").latchedDate
	immediate = window.getRootContainer().getComponent("Calendar").date
	#print system.util.getInactivitySeconds()
	if latched != immediate:
		cal = window.getRootContainer().getComponent("Calendar")

Here’s the client timer script. maybe we’re doing something wrong.

Just assign to it. No need to refresh the binding.


I’m not sure I understand what you mean by “just assign to it”. There’s already an expression binding on it for “dateFormat(now(0), ‘MM-dd-yy 00:00:00’)”. We don’t want to poll this as this will cause 24 queries to execute on the poll and will change the date on the user if they are looking at historical data. The client script will check if the dates are different and the inactivity time exceeds some threshold and then refreshes the component property. I know the script executed as the print statement does show up within the latched!=immediate conditional so the property should have been refreshed, but the red box is still on the date the window was opened. Users are leaving this window open for multiple days.

Assigning to a bound property that isn’t polling yields the same result as refreshing the binding to get that result.

Consider not assigning a string. Assign a true datetime object.