Refresh a text field or drop down list

What is the sytax for refreshing a text field or drop down list, for the component table I use the word table, I’ve tried this with text and text filed and dropdown and I get errors.

Can you elaborate? I’m not sure I understand what is being asked here? Are you talking about the fpmi.db.refresh() function?

Yes, it is the fpmi.db.refresh() function I’m trying to use.

That function takes two arguments. The first is a reference to the component, the next is a string representing the name of the property to refresh. There is an example in the user manual next to the definition of the function.

If you’re having trouble getting it to work post the problematic code here and we’ll help you figure out whats wrong.

DB2,

The fpmi.db.refresh() only works when you have something bound to a DB query. (Carl - correct me if I’m wrong.)

It does not work if your binding uses an expression. However, you can get it to refresh by changing something that the expression depends on.

Note: The following may not address your situation directly so please disregard it if that is the case.

If there is no dependent value that naturally changes, you can resort to a trick I use. Assume there is a drop down list that is bound to an expression. Let’s assume the expression is something like this:

toDataSet(runScript(concat("app.module.methodName('", {Root Container.DynamicPropertyName}, "', ", toInt({Root Container.Trigger}), ")"))) In this example, “app.module.methodName” is the name of a method I’ve defined in the “app.module” module. The method has two parameters. The first parameter corresponds to {Root Container.DynamicPropertyName}, which is a property that the expression would normally depend on. The second parameter corresponds to {Root Container.Trigger}, which is an additional dynamic property that I add for the purpose of triggering an update on the expression. I typically make the trigger parameter optional by giving it a default value and making it the last parameter in the method definition. Here’s an example of such a method:

def methodName(DynamicPropertyName, Trigger = 0): query = ... # query that depends on DynamicPropertyName from fpmi.db import runQuery return runQuery(query) When I want to trigger an update to the expression from a script, I just do something like this:

from fpmi.gui import getWindow window = getWindow("WindowName") if window != None: window.rootContainer.Trigger = not window.rootContainer.Triggerwhich works if I want to trigger an update from another window. If I want to trigger it from the same window, the code looks something like this:

event.source.parent.Trigger = not event.source.parent.Trigger

I found the solution, you have to change the word data to text.

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