Jump to content

Combining More Than Two Conditions


Go to solution Solved by Chris Harp,

Recommended Posts

  • Seeq Team

I am trying to create a composite condition that requires multiple criteria to be met simultaneously. Specifically, I have three separate conditions: Condition A, Condition B, and Condition C. I want to generate a new condition that is true only when all three of these conditions are true. However, the Composite Condition tool only allows combining two conditions at a time, which forces me to create two separate composite conditions to achieve my goal. Is there a more efficient way to combine more than two conditions into a single composite condition?

Link to comment
Share on other sites

  • Seeq Team
  • Solution
Posted (edited)

 When creating a composite condition with more than 2 conditions, you can achieve this by using formula.

To create a composite condition that is true only when all three conditions (Condition A, Condition B, and Condition C) are true simultaneously, we can use the logical and operator. This allows us to combine multiple conditions into a single condition that is true only when all input conditions are true.

Example:

// Combine Condition A, Condition B, and Condition C using the logical and operator
$finalCondition = $conditionA and $conditionB and $conditionC

// Output the final composite condition
$finalCondition

There are various logical operators that we can use within formula to achieve the desired composite condition.

Logical Operators in Seeq's Formula Language

  1. and: Logical AND operator. True if both conditions are true.  Same as using .intersect()
  2. or: Logical OR operator. True if at least one condition is true.  Same as using .union()
  3. not: Logical NOT operator. Inverts the condition.  Same as using .inverse()
    • Be cautious using not or .inverse() without properly bounding your condition which can cause data to not be be display when conditions must be properly bounded.  Use .setMaximumDuration() or .removeLongerThan() or .intersection(past()) or .within(past())
  4. >: Greater than operator. True if the left operand is greater than the right operand.  Same as using .isGreaterThan()
  5. >=: Greater than or equal to operator. True if the left operand is greater than or equal to the right operand.  Same as using .isGreaterThanOrEqualTo()
  6. <: Less than operator. True if the left operand is less than the right operand.  Same as using .isLessThan()
  7. =: Less than or equal to operator. True if the left operand is less than or equal to the right operand.  Same as .isLessThanOrEqualTo()
  8. ==: Equal to operator. True if both operands are equal. Same as .isEqualTo()
  9. !=: Not equal to operator. True if both operands are not equal.  Same as .isNotEqualTo()
     
// Example of using logical operators to create a condition
$conditionA = $signal1 > 10
$conditionB = $signal2 < 20
$conditionC = $signal3 == 30

// Combine conditions using logical operators
$finalCondition = ($conditionA or $conditionB) and (not $conditionC).intersect(past())

// Output the final composite condition
$finalCondition

 

Edited by Chris Harp
grammar
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...