Refreshing data on a table

#1

Ok so i have this table, i can click on an item, it will select that item, then i can click on edit and a pop up will happen that contains the data from the selected row and column of the table from the previous window. So now at this point i can alter the data and write it back to the database.

But when the popup window closes the data in the table does not automatically refresh.

So my one question is as follows: When the lines of code are executed from a button click event, and during execution it comes to a popup windows, does it execute the popup window and then when the popup window closes resumes execution from where it was?

Or what is the best way to have the table refresh the data one a change has been made?

Thanks

0 Likes

#2

Hi mrtweaver,

To answer your question, no, execution does not continue when the popup window is closed. An event script that opens a popup window continues to execute right away after the line that opens the popup window.

The exception to this is a modal popup that is shown with such functions as system.gui.inputBox. So what kind of popup window do you mean? An Ignition window that is used as a popup window, or a modal window that is shown because of a function call to system.gui.inputBox?

The best way to update/refreash a table (or any property) programmatically is to use the system.db.refresh function. You could add a script to the “visionWindowClosed” event of the popup window that gets the window that has the table you want to refresh and refreshes the data property of that table with system.db.refresh.

Best,

0 Likes

#3

Ok I think i understand but the one problem i am having is formatting the sentence correctly. Here is what i have.

table = event.source.getWindow('Test Window').getComponent('standards').getComponent('Customer Table').data
fpmi.db.refresh(table, "data")

But that does not work. I know i am missing something though.

Any help appreciated.

Thanks

0 Likes

#4

Here:

table = system.gui.getWindow('Test Window').getComponent('standards').getComponent('Customer Table') system.db.refresh(table, "data") Best,

0 Likes

#5

Ok first off where is this visionClosed that you speak of in your first posting?

Is it the same thing as internal frame closing?

Or is it more like focus lost?

Either way i tried the script in both of them and it does not like the word system.

0 Likes

#6

Okay, what version of Ignition are you using? In much older versions of Ignition things are different.

0 Likes

#7

Uumm i thought this was the Legacy Products FactoryPMI forum?

Because that is what we are running.

0 Likes

#8

Hi,

It is but I didn’t notice until now. Try using “fpmi” instead of “system” in the function calls.

And try using the internalFrameClosing event on the window instead of visionWindowClosed.

And consider upgrading to Ignition :open_mouth:

Best,

0 Likes

#9

I have tried, unsuccessfully so far, to persuade employer to upgrade to ignition, have downloaded demo and imported my project into it and tested it, so i know that it will work but convincing them of parting with the money is not an easy task. So for now will keep with legacy.

As for the code there must be something that is not quite right yet because since i changed the word system to fpmi now i get the error message:

second argument can not be coerced into an int

Oh well just keep plugging away for now.

0 Likes

#10

Check the user manual for FactoryPMI to see how to use the function.

0 Likes