Filter data out if an OPC tag value is not equal to a specified value
Problem scenario.
I have this item: Kemro.opc.4.IF1.1.92.Mars1.SVs.system.sv_ShotCounter[14]="1" in OPC Data Logger. I want to take data and write it to MySQL, only when the value will be equal "1".
Requirements:
- Advanced OPC Data Logger Enterprise or a trial version.
- Expressions plugin.
It is assumed that:
1. You've created a configuration using the "Green Plus" button in the main window and added an OPC group in the OPC logger and can receive any data from a selected OPC server.
2. The OPC tag has a numerical data type.
3. You've configured a data export to MySQL.
Solution:
1. Enable highlighted options in the OPC group settings.

Fig.1. OPC group settings
2. The tag name must contain alphanumeric or "_" characters only. If the tag name contains other characters (as in the problem scenario), you must assign a new shorten valid name (fig. 2). In this tutorial, the new name will sv_ShotCounter.

Fig.2. Assigning new name
3. Download and install the "Expressions" plugin.
4. Enable it (fig. 3).

Fig.3. Expressions plugin
5. Select the plugin in the list and click the "Setup" button below.
6. In the editor window (fig. 4), specify the following expression. Please, note that the new tag name is used in this expression.
DISCARD_DATA_PACKET_IF(sv_ShotCounter<>1)

Fig.4. Expression
7. Click the "OK" button and save all changes.
Related articles: Filter data out if an OPC tag value is not equal to a specified value
- Inserting OPC data to MS Access database through ODBC (features: adding groups and items, inserting to an ODBC database)
- Adding a timestamp in the CSV file (features: OPC groups)
- How to log OPC data to a SQL database.
- OPC to MSSQL: Writing a lot of OPC tags to MS SQL 2008 database
- OPC to MSSQL: Writing several OPC tags to separate columns
- OPC to MySQL: Writing OPC tags to MySQL 5 database
- OPC to a database: Writing OPC tags to a database
- OPC to Excel: Writing OPC data to Excel
- Filtering data by a tag value and write data to a database only when the value will change
- Filtering data out if an OPC tag value is not equal to a specified value
- Processing or storing OPC data by an event from the OPC server
- Aggregating data from multiple servers to one OPC server
Related topics: Advanced OPC Data Logger
hereOPC Logger RS232 pinout and signals Cables and signals Data monitor cables