Best way to check from one window when another window is closed

I have a window for viewing inventory item details. Not all this information gets updated often, so the bindings on fields dont need to be polled. Occasionally some fields do get edited, so I have a separate window for altering this information. For this I will use quantity as an example.

I have a separate window for editing quantity, you get this window by double clicking the quantity field on the viewing window. After the new quantity is submitted to the DB by this editing window it gets closed. The viewing window now needs its quantity binding refreshed. Is these a good way of tracking when this editing window is opened/closed so I can keep binding refreshes to a minimum?

Thanks for any suggestions.

I’m assuming that the main window data is coming from an SQL query?

If so, you could create a boolean client tag called something like ‘RefreshQuery’ and in your edit button script in your editing window, write the invert of the value of this client tag. Then, on your main window, include thus in your sql query where clause:
WHERE {[Client]RefreshQuery} = {[Client]RefreshQuery}

This will force the query to update whenever the client tag changes value

Edit: yeah, that method has always been a bit clunky. Go with @pturmel 's refresh call.

window = system.gui.getWindow("Window/Path")
system.db.refresh(window.rootContainer.getComponent("Table"), "data")

Consider including a call to system.db.refresh() in your script that saves from the edit window. Point it at the correct property in your viewing window.

1 Like

Sorry for stealing your solution, Phil @pturmel!

No worries. You actually wrote it out for @pandreoli, so not unjust. (: