Tables - I'm missing something

I am trying to create my first table. Starting with a new table component, I did a DB Browse from the data binding pop-up window and selected my table containing 8 columns. I now have 8 column headers with no rows. Now going to the data set viewer, I added 10 rows. After I press OK, The rows disappear after a second or two.

Hi norml,

I have a couple of questions to try and pin down what’s going wrong:

  1. What was the SQL query you ended up with when you did a DB browse? (You can check this by opening up the property binding and selecting “SQL Query”, underneath “DB Browse”.) Does putting this query into a query browser for your relational database return any data?

  2. What was your table’s Polling Options property set to? If it was anything other than “Polling Off”, any lines you add with the DataSet Viewer will be overwritten the next time your SQL Query runs.

Let me know what you’re trying to achieve with your table.

Hi Al,

Thanks for the quick reply. The table that I am trying to build will capture tag values at the end of a machine cycle. I am using a trigger bit to update the tags and add a row of data to the table. I tried turning off the polling and the rows stayed in the viewer. However, they disappear again when I save my changes. When I do the DB Browse, the query is:

SELECT * FROM Welder2_Table WHERE Welder2_Table_ndx = ’ ’

I’ve been going through the manual and help files and I don’t see any step by step procedures for creating tables. Maybe a training video would help. Thanks for your assistance.

Norm

Norm,

You are asking the database for information without specifying the value of the index field - this is why it is returning no information. You will therefore have to tell it which record you want. From what you are describing I would imagine you would want to either return the last record, or perhaps all the records in descending order.

To display the last record select the “SQL Query” option for the table’s data and enter the following query:SELECT * FROM Welder2_Table WHERE Welder2_Table_ndx = (SELECT MAX(Welder2_Table_ndx) FROM Welder2_Table)
To display all the records in descending order enter the following query:SELECT * FROM Welder2_Table ORDER BY Welder2_Table_ndx DESC
I’m assuming your data is being logged by FactorySQL - if you want the data to appear automatically in FactoryPMI without pressing a button, you will have to turn on the Polling for the SQL Query.

Let me know if this works.

Al

Al’s posts are right on. I just want to add something more fundamental. You’re setting up a binding for the data property of the table. This is why when you manually go and edit that property, your edits don’t last long - the binding overwrites them. If polling is off, the binding will run every time the window opens, which happens on a save. We do have training videos, I recommend you check out the PBE (Properties, Bindings, and Expressions) series available here: inductiveautomation.com/supp … category=6

Al - you da man - the query worked perfectly. Guess it’s time to bone up on SQL language.

Carl - thanks for the info and I will certainly chech out the video link.

Norm

Norm,

I’m glad that worked.

The Properties, Binding, Expressions video series is well worth watching in its entirety. Just so you know, SQL binding to tables is covered in Volume 5.

Al