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

Analytics and Notifications for PI System Explorer (PI Server 2024 R2)

Compare

  • Last UpdatedJan 11, 2023
  • 1 minute read

Compare two strings using wildcard characters ("*" and "?") or compare two operands using logical operators and deadband value.

Syntax

Compare {[(s1, s2 [, caseSensitive])]|[x1, x2, op, deadband]}

Arguments

  • s1, s2

    string (s2 can contain wildcard characters)

  • caseSensitive

    Optional flag indicating if the comparison is case sensitive. If False (the default), the comparison is not case-sensitive. If True, the comparison is case-sensitive

  • x1, x2

    Numeric value (integer or real number) or time expression

  • op

    An operator used for comparison. Must be one of the following operators, or a variable defined as one of these: <, >, <=, >=

  • deadband

    Numeric value (integer or real number) or timespan. Deadband specifies a buffer (tolerance) around x2 and prevents repeated alerts when the value fluctuates within the deadband range

Returns

  • True if s1 = s2

  • True if x1 <op> x2 is true, and uses deadband value for subsequent evaluations

False otherwise

Exceptions

Wildcard characters in s1 are treated literally and not as wildcards

The deadband value is applied to x2, not x1

Example

  • Compare('att1', 100, "<=", 5)

    [Returns True if 'att1' is less than or equal to 100, and uses the deadband value of 5 for subsequent evaluations]

  • Compare("What", "what", True)

    [Returns False]

  • Compare("b", "a")

    [Returns False]

  • Compare("What", "wha?")

    [Returns True]

  • Compare("What", "wh")

    [Returns False]

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