FirstValue
- Last UpdatedJan 11, 2023
- 1 minute read
- PI System
- PI Server 2018
- PI Server
Get the first value in an array that satisfies a given condition.
Syntax
FirstValue(a1 [, condition($val)])
Arguments
-
a1
a variable representing the array to operate on
-
condition($val)
any supported PE statement, as a function of $val, that returns a true or false. $val is a placeholder for each value in the array
Returns
The first value that satisfies the given condition
Exceptions
None
Notes
None
Example
-
FirstValue(Data)
[Return the first value from an array named Data]
-
FirstVal(Data, $val < 90)
[From the array named Data, return the first value in the array that is less than 90]