Refreshing SQL Data on Component
The SQL query that populates a data property on a component will refresh its data periodically if the polling mode is set to either relative or absolute. However there are times when you want the data to query the database once when the window is opened and then retain explicit control over each subsequent refresh. The most common way to do this is to have a button near the component that instructs the component's data property to refresh. Any property that is refreshed can be any property that has a binding to a SQL database.
To update a component's property with scripting
-
Select the property on the component that you want to manually update.
-
Create the SQL binding on that component, and for Polling Mode, select Off.
-
Create a Button inside the same Root Container as the component that has the SQL binding.
-
Access the Button's scripting by double-clicking on the Button and selecting the Script Editor tab.
-
Using the system.db.refresh() function, e nter your script that updates the Data property on the component with the SQL binding. This required you to select a reference to the component, and the name of the property to refresh. IE:
Refreshsystem.db.refresh(component,
"propertyName"
)
-
Click OK.