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

  1. Select the property on the component that you want to manually update.

  2. Create the SQL binding on that component, and for Polling Mode, select Off.

  3. Create a Button inside the same Root Container as the component that has the SQL binding.

  4. Access the Button's scripting by double-clicking on the Button and selecting the Script Editor tab.

  5. 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:

    Refresh
    system.db.refresh(component, "propertyName")

  6. Click OK.