I’m having trouble refreshing the Equipment Schedule component via scripting. I currently have the Scheduled Items dataset bound to a SQL query, with the polling mode set to absolute and a relatively long time period (normally a couple minutes, for testing I set it to 30 seconds or so).
I’m trying to add event resizing features to the component, and I have the scripting figured out for updating the underlying SQL table, but the event will snap back to the old size until the component refreshes on it’s internal timer. I tried doing a system.db.refresh on the component dataset, but I’m getting an error. Not sure how to proceed.
Here’s the code I have in the onEventResized event:
#Setup an update query to modify the load time range
db = 'postgres'
query = "UPDATE tiny_loads SET load_timerange = tstzrange(?::timestamptz,?::timestamptz) WHERE id = ?::integer;"
newStartDateObject = system.date.parse(newStartDate)
newStartDate = system.date.format(newStartDateObject,"yyyy-MM-dd HH:mm:ssX")
newEndDateObject = system.date.parse(newEndDate)
newEndDate = system.date.format(newEndDateObject,"yyyy-MM-dd HH:mm:ssX")
args = [newStartDate, newEndDate, eventId]
system.db.runPrepUpdate(query, args, db)
system.db.refresh(self,"Scheduled Events")
And here’s the error it’s spitting out:
18:45:08.147 [AWT-EventQueue-0] WARN com.inductiveautomation.factorypmi.application.components.EquipmentScheduleView - system.db.refresh() was unable to find a refresh-compatible property binding on Equipment Schedule.Scheduled Events
Any thoughts?