Previous Topic: EDITNext Topic: EDIT GROUP


EDIT COMPUTATION

EDIT COMPUTATION allows you to edit computed fields for display. You have the same options as with the EDIT statement.

Syntax:

►►─── EDIt COMputation compute-name ──────────────────────────────────────────►

 ►─┬─────────────────────┬────────────────────────────────────────────────────►
   └─ OFFset field-name ─┘

 ►─┬─────────────────────────┬────────────────────────────────────────────────►
   └─ OLQheader header-name ─┘

 ►─┬──────────────────┬───────────────────────────────────────────────────────►◄
   └─ display-option ─┘

Parameters:

compute-name

The name of the field to be edited.

OFFSET field-name

Specifies under which column the computed field specified by a COMPUTE GROUP BY command should be displayed. The default is the first column named in the COMPUTE statement's GROUP BY expression.

OLQHEADER header-name

Provides a report heading containing the column value of the group field. The user-supplied header takes on the edit characteristics of the computed field. Header-name can consist of:

display-option

Any of the valid display options for the EDIT statement. These options are listed under the EDIT statement.

Examples:

These examples are based on the report built with the following commands:

select dept-id-0410,emp-last-name-0415, salary-amount-0420 from department, employee, emposition where dept-employee and emp-emposition compute average-salary=avg(salary-amount-0420) group by dept-id-0410 ! display DEPARTMENT/EMPLOYEE/EMPOSITION REPORT mm/dd/yy DEPT-ID-0410 EMP-LAST-NAME-0415 SALARY-AMOUNT-0420 ------------ ------------------ ------------------------- 6666 HENDON 240000.00 6666 PAPAZEUS 100000.00 6666 PAPAZEUS 90000.00 6666 RUPEE 80000.00 6666 RUPEE 76000.00 6666 WILDER 90000.00 ----------- AVERAGE-SALARY 112666.66 2000 BLOOMER 15000.00 2000 HUTTON 44000.00 2000 JENSON 82000.00 2000 KIMBALL 45000.00 2000 KING 14500.00 - 1 -

Edit Olqheader

You can change the header for the AVERAGE-SALARY field:

edit computation average-salary olqheader 'avg-sal for dept $dept-id-0410' ! display DEPARTMENT/EMPLOYEE/EMPOSITION REPORT mm/dd/yy DEPT-ID-0410 EMP-LAST-NAME-0415 SALARY-AMOUNT-0420 ------------ ------------------ ------------------ 6666 HENDON 240000.00 6666 PAPAZEUS 100000.00 6666 PAPAZEUS 90000.00 6666 RUPEE 80000.00 6666 RUPEE 76000.00 6666 WILDER 90000.00 ----------- AVG-SAL FOR 6666 112666.66 2000 BLOOMER 15000.00 2000 HUTTON 44000.00 2000 JENSON 82000.00 2000 KIMBALL 45000.00 2000 KING 14500.00 - 1 -

Edit $, Commas

You can include dollar signs and commas in the computed field:

edit computation average-salary $ commas ! display DEPARTMENT/EMPLOYEE/EMPOSITION REPORT mm/dd/yy DEPT-ID-0410 EMP-LAST-NAME-0415 SALARY-AMOUNT-0420 ------------ ------------------ ------------------- 6666 HENDON 240000.00 6666 PAPAZEUS 100000.00 6666 PAPAZEUS 90000.00 6666 RUPEE 80000.00 6666 RUPEE 76000.00 6666 WILDER 90000.00 ----------- AVG-SAL FOR 6666 $112,666.66 2000 BLOOMER 15000.00 2000 HUTTON 44000.00 2000 JENSON 82000.00 2000 KIMBALL 45000.00 2000 KING 14500.00 - 1 -