Versions Compared

Key

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

List of Logical Statements

The following are logical statements that can be used within the expressions of iif parameters:

.EQ. → Equal to (==)

.NE. → Not equal to (!=)

.LT. → Less than (<)

.LE. → Less than or equal to (<=)

.GT. → Greater than (>)

.GE. → Greater than or equal to (>=)

.AND. → AND (&&)

.OR. → OR (||)

.NOT. → NOT (!)

Example:

Code Block
languagexml
<O N="iifobject1" T="Project" Category="Logical Statement and Test" TransAlignRule="Right">
    <!-- created by ParamML Examples on 09.02.2023 -->
    <P N="a" V="3" />
    <P N="b" V="-40" />
    <P N="c" V="-25" />
    <P N="d" V="-30" />
    <P N="e" V="80" />
    <O N="iffexample" T="DesignCode">
        <P N="Test1" V="iif(a .GE. b,c,d)" />
        <P N="Test2" V="iif(a .EQ. 1,b, a .EQ. 2,c,a .EQ. 3,d,a .EQ. 4,e)" />
    </O>
</O>
Image Added

In the example provided, if the value of "a" is greater than "b", then the result of "Test1" will be "c". If not, the result will be "d".

In "Test2", a nested "iif" function is utilized to handle more complex tests.
If the value of "a" is equal to 1, the result will be "b".
If "a" is equal to 2, the result will be "c".
If "a" is equal to 3, the result will be "d".
And, if "a" is equal to 4, the result will be "e".

To view this example in the library, see (https://openbrim.org/platform/?application=inc&author=ParamML_Examples_OpenBrIM+Platform&folder=Logical+Statement+and+Test&obj=objidiks1ubk6utmhxl8k59dx4f)

Example:

Code Block
languagexml
    <O N="Calculation1" T="Group">
        <!-- .GE. → Greater than or equal to (>=) -->
        <P N="Len" V="3000" D="Length of ground" Role="Input" Category="Calculation1" />
        <P N="dynamic_effect" V="1+15/(Len/1000+37)" D="Dynamic effect Index" />
        <P N="Usedynamic_effect" V="iif(dynamic_effect .GE. 1.3, 1.3, dynamic_effect)" />
    </O>

The dynamic effect coefficient is determined using a formula. If the calculated value is greater than or equal to 1.3, it is set to 1.3. If it is less, the calculated value is used. This is presented as follows:

Image Added
Code Block
languagexml
    <O N="Calculation2" T="Group">
        <!-- .AND. → AND (&&) example -->
        <P N="A" V="22" />
        <P N="B" V="20" />
        <P N="C" V="12" />
        <P N="C1" V="iif(A .LT. B .AND. B .GT.C,C,9)" />
    </O>

.AND. In this expression, both the conditions on the left and right must be satisfied in order for the positive value to be accepted.

The value at which C1 will occur will be 9, as the condition A<B is not provided, but B>C is provided. However, if both conditions are not met simultaneously, C1 will be assigned a negative value. In this case, C1=9.

Image Added
Code Block
languagexml
    <O N="Calculation3" T="Group">
        <!-- .OR. → OR (||) example-->
        <P N="A" V="22" />
        <P N="B" V="20" />
        <P N="C" V="12" />
        <P N="C1" V="iif(A .LT. B .OR. B .GT.C,C,9)" />
    </O>

.OR. A positive value is accepted if one of the two conditions is met in the statement.

The value at which C1 will occur will be 12 because A<B equality is not provided, B>C is provided. If only one of these two conditions is true, the result leads to a positive value. C1 takes the positive value and becomes C1=C. So C=12.

Image Added
Code Block
languagexml
        <O N="Calculation4" T="Group">
        <!-- .EQ. NULL example -->
        <P N="A" V="NULL" />
        <P N="B" V="NULL" />
        <P N="C" V="12" />
        <P N="D" V="35" />
        <P N="E" V="50" />
        <P N="C1" V="iif(A .EQ. B .AND. A .EQ. NULL,E,15)" />
    </O>

.EQ. The NULL expression searches for the absence of an object.

C1=E. So C1=50 .

Image Added

To view this example in the library, see (https://openbrim.org/platform/?application=inc&author=ParamML_Examples_OpenBrIM+Platform&folder=Logical+Statement+and+Test&obj=objid1gymiqj4il4qsujbia5hbf)