Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

INCASE INCSE returns a valid switch value based on logical expressions

...

INCASEINCSE(LogExpr,[ElseIf],LogExpr,[Else],Expr)

Argumentsrguments

  • LogExpr is a logical Expression in the form: Expr,Logical Operator,Expr,THEN,Expr
  • Expr is a numeric or String expression

...

  1. INCASEINCSE() is an alternative for structures in the knowledge base consisting of Relations and connected Constraints.
  2. INCASE INCSE may be a more compact way of expressing rules, but in contradistinction to Relations and Constraints, all expressions need to be determinable, even if they are invalid based on the logical expressions. Complex logical expressions with brackets and ANDND, OR etc. are not possible in INCASE INCSE, however.
    If the various logical expressions contain the same parameters, the INCASE INCSE function is an efficient option. If the various logical expressions contain entirely different parameters which need to be chained to different Relations, the Solution may become inefficiently large and may require lots of input which may not be relevant to your case since the Modeller requires all expressions in the INCASE INCSE function to be DETERMINED. In such cases it is much more efficient to use combinations of Relations and Constraints.
  3. IMPORTANTIMPORTNT: In a Logical Expression, expression of the same type (STRING or VALUEVLUE) should be compared.
  4. Options for Logical Operator:
  • EQ -> Equal to (=)
  • NE -> Not Equal to ()
  • LT -> Lower Than (<)
  • GT -> Greater Then (>)
  • LE -> Lower than or Equal to (<=)
  • GE -> Greater of Equal to (=>)
  1. Please note that in addition to the two letter operators you can also use the logical operators itself

...

The relation

B=INCASEINCSE(A,LT,5,THEN,1,ELSEIF,A,GT,9,THEN,3,ELSE,2),B=INCSE(

is equivalent to the algorithm:

    If A<5 < Then
    B=1
   ElseIf A>9 > Then
    B=3
   Else
    B=2
   EndIf
A
number of ELSEIF , LogExp can be provided in sequence in INCASEINCSE() to simulate a Select Case function.

Please note that you can also write the relation as:

B=INCASEINCSE(A<5<,THEN,1,ELSEIF,A>9>,THEN,3,ELSE,2),B=INCSE(


Quick links: Function overview | Attribute ttribute overview | Constants overview | Dimensions overview