2.9           Conditions

You can specify conditions for formula attributes. Conditions are indicated by braces {}. Conditions are written in the manner of a case instruction.

There are always several alternatives per condition. Conditions can be nested.

The formula attribute must contain a blank after the reference value for a condition!

Key identification { }

Condition

Syntax:

{ [ j ]  <condition formula>

[  { [ = | < | > | <> | : ("<value string>" | <aid> )   ]1+   blank
<execution formula>  }  ]1+  }

j

Following processing of the condition, jump to the object preceding the execution.

Condition formula

Formula string whose result yields the test string.

 =, <>, <>

Check for equality, inequality, larger or smaller. Numbers are also checked as string comparison.

Value string 

The character string that is compared with the test string. Here it is also possible to access register contents.

aid

Alternative value of an attribute at the start object that is compared with the test string.

:""

This statement (without condition) specifies the Else case of the case instruction. Here you can specify what is to be done if none of the other conditions is met.

Execution formula

Instruction that is carried out if the test was successful. Any sequence of possible commands is permitted as execution formula. For example:

-        Text included in inverted commas (" ")

-        Attribute value

-        Formula

-        …..

Examples of formulas with conditions:

Comparison of 2 attribute values:

The attribute with the ID=245 contains the width and that with the ID = 246 the height of an object.

·            {A245;{=246 "equal";}{:"" "not equal";}};

Result for width = 20.00 mm and height = 20.00 mm "equal"
Result for width = 20.00 mm and height = 30.00 mm "unequal"

·            {A245;{=246 "2 x ";A245;}{:""  =*A245A246; " mm";}};

Result for width = 20.00 mm and height = 20.00 mm: "2 x 20.00 mm"
Result for width = 20.00 mm and height = 30.00 mm: "600.00 mm"

·            {=f+A245A246;{="40" "forty";}{:""  =f+A245A246; " mm";}};

If the sum of height and width is = 40, "forty" is to be output, otherwise the sum of width and height is to be shown as floating point number in "mm"

Check whether an attribute value meets a certain condition:

·            {AF245(256);{="1" "manual ";A245;}{:""  A245;}};

AF245(256) issues the value "1" if the attribute with the ID = 245 was entered manually.
Result for manual entry of the attribute with the ID = 245: "manual 20.00 mm".

·            {A10025;{="1" A10001;}{:"" A10002;}};

Let the attribute with the ID=10025 be a Boolean one.
If it has the value "1", then the value of the attribute with the ID=10001 is output, otherwise the value of the attribute with the ID=10002.

·            {A5;{="20"<"10">77 "within range";}{:"" "not within range";}};

If the value of the attribute with the ID=5 equals 20 or is smaller than 10 or larger than the value of the attribute with the ID=77 of the start object, then the result of the formula is "within range". If the condition is not met, then the message "not within range" is issued.

·            {A5;{="1"<"2" "<2";}{="10">"24" ">24";}{:"" "default";}};

If the value of the attribute with the ID = 5 is equal to 1 or smaller than 2, then "<2" is issued If the value is equal to 10 or larger than 24, ">24" is issued. If none of these conditions is met, then "default" is issued.

Exercise:

For each child object of the first level (A1, A2) all child objects of the second level (1.2, 1.3, 2.2, …) should be listed. The child objects of the first level should be separated with “ / “ those of the second level with “ # “.Once the value of the child object of the second level reaches 2.3, the execution of the formula should be terminated.

Formula used:

Result of the formula: START  1.2 # 1.3 / 2.2 #

Exercise: 

If the equipment is a termial, the output should be the function of the terminal block, the terminal block, the function of the terminal and the terminal. Otherwise the output should be “<> Terminal“.

 

Function used:

Result of the formula:

at Terminal (Start object 1): .PS -0X1 .PS 1

at End Cover (Start object 2): <>Terminal