Newbie Question: Kind of urgent

We are currently evaluating FSQL and I need some design assistance for what I am trying to accomplish.

We have a application that we are using in conjuction with FSQL and a PLC for production line control. We have given the operators to change certain timing values in the PLC via the VB application. When they change the values in the VB application, those values are written back to a SQL database using an update statement.

The question I have is…how do I write those values down to the PLC, ONLY when they have changed in the SQL database? I attempted to use the Expression language but didn’t get very far. I know what I want to do, but I am not sure how to get from Point A to Point B.

As a side note, the SQL table houses other settings that has nothing to do with the PLC, so I need to select specific values from the table and “map” them to my OPC values to be written down to the PLC. Sorry for the long explanation.

Any help would be greatly appreciated.

This is exactly what the standard group in FactorySQL does when it is in “Bidirectional” mode. You don’t need any action items - just regular old OPC items. The OPC item’s name is the column name in the database that it maps to, and its OPC item adddress is where it maps to in the PLC. The only thing left is how to get it to map to the right row - which is what the bottom portion of the “Action” tab is for.

What does your table look like?

Thanks for replying so quickly Carl.

The table I want to pull from has about 20-25 columns and only one record (there will never be more than one). There are about 15 of these columns that pertain to me, the balance is for settings within the VB application.

I knew this should be simple, but maybe a quick step-by-step would shove me in the right direction.


Great, in that case all you need to do is:

Create a new (standard) group.
Drag the OPC item into that group that you are interested in.
Rename it so that its Field Name matches the column name in your database table.
Under the “Action” tab:
Sets its Update Mode to “Bidirectional, OPC Wins”
Set the database connection.
Uncheck all checkboxes.
Set the Table Name.
Choose “Update/Select” and “First Record”

Thats it - run the group and you should be all set.
You might want to check out our video tutorial library.

Thanks Carl.

I was on the right path, but when I followed your suggestion, I get an error message that says FSQL couldn’t find the expected index column. The table that I am pulling from is not a FSQL auto-generated table, nor does it have an index field.

So, being proactive, I just selected a column as the index since there is only one record. Then FSQL wants to add “missing columns” to my table. The columns are already in there, so I’m not sure what I am doing wrong?

Forgive my ignorance. :confused:

What columns did it want to add?

Sorry Carl. False alarm. My bad.

The column names in the SQL database were just a hair different than my tag names and that was throwing the flag. I will clean those up and it should work just fine.

Thanks again for all your help.

Pesky computers are soo picky… :smiley: