Previous Topic: Defining Column Levels and ValuesNext Topic: Mapping Considerations


Examples

The following examples illustrate how initial values and calculations can be used in applications developed by ASF.

Defining an Initial Value for a Column

The initial value for the HOURS column is:

INITIAL VALUE:  40

The EMPLOYEE (OT) table is displayed through the Load function:

EMPLOYEE (OT)
NAME
NUMBER
GRADE
HOURS                           40
WAGE
REGULAR PAY
OVERTIME PAY
TOTAL PAY

Defining a Single-Value Calculation

The EMPLOYEE table and the POSITION table are joined on the NUMBER and EMPLOYEE NUMBER columns. The EMPLOYEE NUMBER column is not displayed in the EMPLOYEES AND THEIR POSITIONS view. To ensure that the join columns are always equal, a calculation is defined for the EMPLOYEE NUMBER column, as follows:

CALCULATION: NUMBER

When the NUMBER column of the EMPLOYEE table is modified through the view, the EMPLOYEE NUMBER column is automatically modified in the POSITION table. The modification is allowed through the view because both join columns are modified and the join condition remains true.

Defining an Arithmetic Calculation for a Column

The calculation defined for the OVERTIME PAY column is:

CALCULATION: (HOURS - 40) * (WAGE + (WAGE * .5))

The result displayed in the EMPLOYEE (OT) table is:

EMPLOYEE (OT)
NAME                            SAM MORRIS
NUMBER                          4236715B
GRADE                           C
HOURS                           50
WAGE                            12.75
REGULAR PAY
OVERTIME PAY                    191.25
TOTAL PAY

Defining Calculations for More than One Column

The calculation for the OVERTIME PAY column is:

CALCULATION: (HOURS - 40) * (WAGE + (WAGE * .5))

The calculation for the REGULAR PAY column is:

CALCULATION: 40 * WAGE

The calculation for the TOTAL PAY column is:

CALCULATION: REGULAR PAY + OVERTIME PAY

The results displayed in the EMPLOYEE (OT) table are:

EMPLOYEE (OT)
NAME                            SAM MORRIS
NUMBER                          4236715B
GRADE                           C
HOURS                           50
WAGE                            12.75
REGULAR PAY                     510.00
OVERTIME PAY                    191.25
TOTAL PAY                       701.25