7.8.12.2. Syntax - Buttons for creating the formula

If you use the $VAR= | IF | ELSEIF buttons, you can be sure that the correct syntax is used when creating the formula.

[Note]Note

Finally, use Check to check the entire entry.

"Feature algorithm [Attribute algorithm] " dialog box

"Feature algorithm [Attribute algorithm] " dialog box

  • $VAR=

    This button only transfers the variable displayed under Name to the input field.

  • IF

    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.

    Example with values:

    IF (L1.EQ.10) THEN
    D3 = 20
    ELSE
    D3 = 30
    ENDIF

  • ELSEIF

    -> The following is generated:

    ELSEIF ( ) THEN
     <selektierte Variable> = 

    If case distinctions are to be made, ELSEIF statements can be used.

    [Note]Note

    ELSEIF case distinctions must be concluded with an ELSE at the end.

    So before you click, place the cursor in the correct position before the ELSE command.

    Example with values

    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:

    IF ( KG.EQ.'-')THEN
     NB1 = '$TNR. $TYP.-$KDM.-$HUB.-ZR-$WZ.'
    ELSE
     NB1 = '$TNR. $TYP.-$KDM.-$HUB.-ZR-$WZ.-$KG.'
    ENDIF
    IF ( ZAK.EQ.'-')THEN
     NB1 = '$NB1.'
    ELSE
     NB1 = '$NB1.-$ZAK.'
    ENDIF
    IF( YSR.EQ.'1'.AND.SIE.EQ.'-')THEN
     NB1 = '$NB1. ZUB-C'
    ELSEIF( YSR.EQ.'1'.AND.SIE.EQ.'1')THEN
     NB1 = '$NB1. ZUB-CL'
    ELSEIF( YSR.EQ.'2'.AND.SIE.EQ.'-')THEN
     NB1 = '$NB1. ZUB-$YSR.C'
    ELSEIF( YSR.EQ.'2'.AND.SIE.EQ.'1')THEN
     NB1 = '$NB1. ZUB-$YSR.CL'
    ELSEIF( YSR.EQ.'-'.AND.SIE.EQ.'1')THEN
     NB1 = '$NB1. ZUB-L'
    ELSE
     NB1 = '$NB1.'
    ENDIF                                            

    Im  ersten IF wird NB1 initialisiert.
    
    
    
                                        
    Im zweiten IF wird an NB1 etwas drangehängt.
    
    
    
                                         
    Im dritten IF wird nochmal etwas drangehängt.
    
    
    
    
    
    
    
    
    
    
    
                                             

    Important notes:

    • 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.

      Correct:

      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.

      Correct:

      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...