Update a PMI table with a button

What would be the best way to update a PMI table “run a fpmi.db.runQuery()” using a button?

Select the button and go to “configure actions” (Cntl+J). Under the event “actionPerformed” insert your Jython code.

If you’re using an UPDATE, INSERT, or DELETE query you’ll want to use fpmi.db.runUpdateQuery().

What exactly do you want to do?

I’m looking to refresh the data displayed by the table with the button instead of using polling. Would I use runUpdateQuery() or could I just use just runQuery().

Use fpmi.db.refresh() to refresh a propery that’s bound to an SQL query.

#The example below refreshes the data property of “Table (1)”.

table = event.source.parent.getComponent("Table (1)")
fpmi.db.refresh(table, "data")

Tip: Use the Set Property tab of the Action Configuration Window and navigate to the property that you want to set. Go to the Script editor and use that path.

This might go without saying, but when doing this make sure to set your bound property’s polling option to “Polling Off”. Otherwise you’ll still be polling on a timer, in addition to when you click the button.