Database structure and "quality_code"

I have studied the database-structure that is created by FacotrySQL.
I do see that each tag gets its own “column” in the database-table. And that all tags in one group only share the same “quality_code” column.
If you have a group of 1000 items/tags. If one of the 1000 items returns “Bad OPC Quality” when reading from the OPC, does that mean that the value of the “quality_code” is set to bad for all of these 1000 tags?
How do you handle this?

When I first heard of FactorySQL i thought that each tag would get its own row (not column) and that you would have a “OPC Quality” column for each tag.
Is there a reason for not doing it this way? Is this something that is possible to configure?

If you create a group with multiple items and tick the ‘Store OPC quality code’ box, the code that is saved is created by logically ANDing the codes for all the items together. This does mean that if only one item is in error, the code for the whole group will show an error.

It is possible to record the quality codes for each item separately. To do this, add an item to a group, then double-click the item to edit it and change the Property field from Value (the default) to Quality. Note that you will have to add 2 copies of the item to record both value and quality.

You might want to consider creating 2 groups, one for value and the other for quality, both groups having an identical trigger so the data in each group is recorded at the same time. If you go down this route, it is possible to change the Property of multiple tags simultaneously, by highlighting all the tags you wish to change before double clicking and changing the Property field.

There are 2 ways to approach recording multiple values in a database: wide (multiple values in one row for each record) or tall (one value in multiple rows). It is normally easier when dealing with logged data to access multiple values in one row. However, if you want to store one value per row, you can do this using a Block Group. This will also allow you to record the quality of each tag separately. The restriction here is that the points must be held in contiguous registers in your PLC - the help file covers this.

Hopefully one of these approaches will work for you.


Thanks a lot for the quick and good answers for both posts!

You’re welcome :slight_smile: