Copyright © Cloud Software Group, Inc. All Rights Reserved |
The COUNT rule in the following figure is a generic rule that determines the sum of a field over all occurrences. The rule is general enough to sum any field of any table (without parameters). The rule receives the name of the table in the argument TABLEREF and it receives the name of the field in the argument FIELDREF.
• The parentheses around the names TABLEREF and FIELDREF in the assignment statement signify indirection.
• The FORALL statement loops over the table specified by the indirect table reference (TABLEREF), and the action in the body of the loop involves the field specified by the indirect field reference (FIELDREF).The value of TABLEREF is EMPLOYEE_VIEW, and the value of FIELDREF is SALARY. The called rule finds the sum of the salaries of all employees.
•
Copyright © Cloud Software Group, Inc. All Rights Reserved |