Example

Given SELECT ID, NAME, DEPT, SALARY, COMM FROM Q.STAFF, a new column is defined with the following expression and PASS NULLS is set to YES:

@If(&3=10,'MGMT',&5=DSQNULL,'N/A',&5/&4*100)

This expression can be logically restated as:

Select
  When &3 = 10    Return MGMT      /* All Department 10 are managers */
  When &7 is NULL Return N/A        /* Comission is NULL, mark N/A    */ 
  Otherwise       Return &7/&6*100 /* All others, calculate Comm % */  

The results would be displayed as:

 ID  NAME      DEPT  SALARY      COMM  %
---  --------  ----  --------  ------  ----
 10  SANDERS    20   18357.50       -  N/A
 20  PERNAL     20   18171.25  612.45  3.37
 30  MARENGHI   38   17506.75       -  N/A
110  NGAN       15   12508.20  206.60  1.65
120  NAUGHTON   38   12954.75  180.00  1.38
160  MOLINARE   10   22959.20       -  MGMT
[ Previous Page | Next Page | Contents | Index ]