Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Historian

IF examples

  • Last UpdatedMar 07, 2025
  • 1 minute read

Example 1

This example uses the following tag name:

  • Pump101.Flow measures the flow rate of a pump in liters per second (L/s)

The following expression returns the flow rate of a pump, but any negative values are replaced with 0.

IF( Pump101.Flow < 0, 0, Pump101.Flow )

Represented as a query:

SELECT DateTime, Value, OPCQuality

FROM History

WHERE wwExpression = 'IF( Pump102.Flow < 0, 0, Pump102.Flow )'

Results over a 5 minute interval:

DateTime

Value

OPCQuality

2022-03-31 12:40:01.2590000

4.00229740142822

192

2022-03-31 12:40:03.2590000

0.365068227052689

192

2022-03-31 12:40:05.2590000

0

192

...

...

...

2022-03-31 12:44:59.2590000

27.5106182098389

192

Represented as a line chart over a 1 hour interval:

IF example data in chart.

Example 2

The following expression returns 1 when system CPU usage exceeds 90%, otherwise it returns 0.

IF( SysPerfCPUTotal > 90, 1, 0 )

Example 3

The following expression returns 1 when system CPU usage exceeds 90%, otherwise it returns a NULL value.

IF( SysPerfCPUTotal > 90, 1 )

Example 4

The following expression returns a true value (1) when system CPU usage exceeds 90%, otherwise it returns a false value (0).

IF( SysPerfCPUTotal > 90 )

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in