If you use the | | buttons, you can be sure that the correct syntax is used when creating the formula.
This button only transfers the variable displayed under Name to the input field.
An algorithm built using an IF condition can look like this:
IF ( ) THEN D3 = ELSE D3 = ENDIF
Enter your condition between the brackets () (e.g. "L1.EQ.10"). In this example, "D3" is the variable selected in the variable list.
After THEN D3 = enter the value that D3 should assume if the condition is met .
ELSE D3 = is followed by the value for D3 if the condition is not fulfilled . ENDIF concludes the condition.
IF (L1.EQ.10) THEN D3 = 20 ELSE D3 = 30 ENDIF
-> The following is generated:
ELSEIF ( ) THEN <selektierte Variable> =
If case distinctions are to be made, ELSEIF statements can be used.
IF (L1.EQ.10) THEN D3 = 10 ELSEIF (L1.EQ.20) THEN D3 = 20 ELSEIF (L1.EQ.30) THEN D3 = 30 ELSE D3 = 40 ENDIF
Within a feature algorithm variable [Attribute algorithm], several IF conditions can also be connected in series.
The use of a single IF condition with ELSEIF case distinctions would often lead to much more complex solutions with many more ELSEIFs.
Structure of conditions with the help of an example:
The first IF condition must contain an ELSE alternative to ensure that the variables are initialized. The remaining IF conditions can optionally contain ELSE alternatives.
IF (OPZ1.EQ.'-' )THEN LINAALG = '$IDNR./$CX1./$VL./$MOTX./$OM1./$COEL./$DA./$AP1./$AA1.' ELSE LINAALG = '$IDNR./$CX1./$VL./$MOTX./$OM1./$COEL./$DA./$AP1./$AA1./$OPZ1.' ENDIF IF (OPZ2.EQ.'-' )THEN LINAALG = '$LINAALG./' ELSE LINAALG = '$LINAALG./$OPZ2.' ENDIF...
Not correct: (The first IF does not contain an ELSE)
IF (OPZ1.NE.'-' )THEN LINAALG = '$IDNR./$CX1./$VL./$MOTX./$OM1./$COEL./$DA./$AP1./$AA1./$OPZ1.' ENDIF IF (OPZ2.NE.'-' )THEN LINAALG = '$LINAALG./$OPZ2.' ENDIF...
Also correct: If the first statement is a simple statement without a condition, an "ELSE" can be omitted completely, as the statement always initializes the variable.
CNSTYPECODE = '$MODEL.$W.-$ST.-$THETA.-$TYPE.-$SPRING.' IF(K.EQ.1)THEN CNSTYPECODE = '$CNSTYPECODE.-K' ENDIF IF(FK.EQ.1)THEN CNSTYPECODE = '$CNSTYPECODE.-FK' ENDIF IF(N.EQ.1)THEN CNSTYPECODE = '$CNSTYPECODE.-N' ENDIF
The first condition, which is always calculated, has to prevent an endless loop. Following "if...endif" always call the first condition and attach an additional value.
So in the first condition do not use the variable of assignment for the ELSE case.
IF (OPZ1.EQ.'-' )THEN LINAALG = '$IDNR./$CX1./$VL./$MOTX./$OM1./$COEL./$DA./$AP1./$AA1.' ELSE LINAALG = '$IDNR./$CX1./$VL./$MOTX./$OM1./$COEL./$DA./$AP1./$AA1./$OPZ1.' ENDIF IF (OPZ2.EQ.'-' )THEN LINAALG = '$LINAALG./' ELSE LINAALG = '$LINAALG./$OPZ2.' ENDIF...
Not correct: (difference in red)
IF (OPZ1.EQ.'-' )THEN LINAALG = '$IDNR./$CX1./$VL./$MOTX./$OM1./$COEL./$DA./$AP1./$AA1.' ELSE LINAALG = '$LINAALG./$OPZ1.' ENDIF IF (OPZ2.EQ.'-' )THEN LINAALG = '$LINAALG./' ELSE LINAALG = '$LINAALG./$OPZ2.' ENDIF...