Replacing a Table Cell Value with a Numeric Text Value

I’m trying to let the user change the tank alias of the currently selected row in the table by changing the value of a numeric text field.

In FocusGained:

[code]value = event.source.intValue #Numeric field’s value
tankName = event.source.parent.getComponent(‘Tank Number’).intValue

fpmi.db.runUpdateQuery(“UPDATE TankSummary SET Tank Alias = value WHERE Tank = tankName”)[/code]

When I click on the numeric field, I get this error: “Datasource “Induct_Database” is FAULTED.” Is there something wrong with my syntax?

The runUpdateQuery function has a problem with your project’s default data source (Induct_Database).

To check the status of the datasource, go to your gateway status web page, then click on the “Datasources” tab.

localhost:8080/gateway/Gateway?tab=datasources

You can troubleshoot the Datasource in the gateway configuration web page under Datasources->Connections by editing your datasource (Induct_Database). If this datasource has worked before you’ll want to make sure the database is running. If it never has, you probably have a setting incorrect such as the username/password.

Alternatively, you can specify running the query against another datasource in the following format:

runUpdateQuery(Query, [DataSource])

yours might look something like this:

fpmi.db.runUpdateQuery("UPDATE TankSummary SET Tank Alias = value WHERE Tank = tankName", myOtherDataSource)

Thank you for your help!

I have another question: can I make those changes to the table without using a data source?

Not quite sure what you’re asking here. you want a FactoryPMI table component full of static data in a window, where the user can change the data, but you don’t want the data to come from a database?

You can do this (it involves a bit of scripting, because there usually isn’t much point in doing this), but please let me know if this is what you were really asking.

Yes, that’s what I’m asking about. However, I got the data source to work, so I don’t need to do that anymore.

This leads to another question, though: how and where do I add tables to my database?

Thanks again for your help; I really appreciate it.

You add tables to your database from the database itself. What database are you using? (eg MySQL, Microsoft SQL Server, etc) Most databases come with some front-end software that makes adding tables easy.

Its important to remember that the database isn’t actually a piece of our software, rather, we work with any standard database. You might want to take a look at our software architecture picture here inductiveautomation.com/prod … /?id=AD-B3

Hope this helps,

We’re using MSSql for now. However, we’re not connected to any live data because our company is just trying out Factory PMI.

Thanks for your help; I’ll see if MSSql has any frontend software.