Formulas y Estructuras de Control

Arriba  Anterior 

 

Estructuras de control

 

IF… ELSE… ENDIF

 

IF LiqProf->Moneda == “E”

       IF LiqProf->Importe > 0

               RETURN LiqProf->Importe * 0.20

       ELSE

               RETURN 0

       ENDIF

ELSE

       RETURN 0

ENDIFF

 

 

 

 

DO CASE … CASE … ENDCASE

 

DO CASE

       CASE LiqProf->Importe <= 0

               RETURN 0

       CASE LiqProf->Importe > 0 .AND. LiqProf->Importe <= 500.00

               IF LiqProf->CodProfe == 1

                       RETURN 25

               ELSE

                       RETURN LiqProf->Importe * 0.15

               ENDIF

       CASE LiqProf->Importe > 500.00

               IF LiqProf->CodProfe == 1

                       RETURN 35

               ELSE

                       RETURN LiqProf->Importe * 0.20

               ENDIF

       OTHERWISE

               RETURN LiqProf->Importe * 0.10

ENDCASE

 

 

Operadores

       *         Multiplicar

       -        Restar

       /        Dividir

       +         Sumar

       .AND.        Operador Lógico (Y)

       .NOT.        Operador Lógico (No)

       .OR.        Operador Lógico (O)

       ==        Igual

       !=        No igual a

       <>        Distinto de

       >=        Mayor ó igual que

       <=        Menor ó igual que

 

 

VALORES

 

Una Fecha :

       {03/05/2006}

       CTOD(“03/05/2006”)

       LiqProf->Fecha >= {03/05/2006}

       LiqProf->Fecha >= CTOD(“03/05/2006”)

 

Un texto :

       “PR”

       LiqProf->CodSer == “PR”

 

Un valor Numérico (las ',' comas se indican con un punto '.'):

       0.25

       LiqProf->Importe > 37.40

 

sp;  0.25

       LiqProf->Importe > 37.40

 

html>