KB-33563: Keeping negative values from being recorded in the database.

Question:

How can I make a series of I/O tags display 0 whenever they return with a negative value (i.e., below zero), so as to make it possible their being recorded by the Database?

Solution:

To do so, there are two possible solutions:

1. To record the value directly in the database, access this object, select the Historic where the value must be stored and, on Source column, add the following command line: (sgn(IOTag)+1)/2*IOTag, (Tag = desired I/O tag).

2. To just show the value in a display, use a multiple connection, search for the desired tag, and select its type as Multiple Connection, where:

Min = -MinimumValue ; Max = 0 ; source = 0
Min = 1 ; Max = MaximumValue ; source = Tag.Value (Desired Tag’s value)

The same can be done to record the value in the Database: link the I/O tag to an internal tag, turn the connection on, and then record the internal tag in the Database.

Attached to this article is a demo application illustrating these procedures.

Attachments:

Sample

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *