Previous Topic: Group Aggregation TARGETING Repeating Group ViewsNext Topic: Group Aggregation With Selection and Sort Criteria


Group Aggregation Using Explicitly Indexed Repeating Group Views

You can populate an explicitly indexed repeating group view by using a PLACING clause, if each iteration of the SUMMARIZE EACH statement is preceded by a SET SUBSCRIPT for that view:

SET SUBSCRIPT OF repeating_group_local to 1 
SUMMARIZE EACH GROUP OF employee 
WITH THE SAME employee_job_grade 
PLACING employee_job_grade INTO local employee_job_grade 
PLACING GROUP count(OCCURRENCES) INTO local employee_count 
SET SUBSCRIPT OF repeating_group_local to SUBSCRIPT OF repeating _group_local + 1 
SET LAST OF repeating_group_local to SUBSCRIPT OF repeating_group_local - 1

Note: The SET LAST statement is needed because the last SET SUBSCRIPT statement executed will follow the last successful SUMMARIZE EACH iteration, and thus will index an unused occurrence. This is important when assigning cardinalities to explicitly indexed views populated by the SUMMARIZE EACH statement.

The following example shows attribute view definitions associated with explicit:

LOCALS:
Group View repeating_group_local (4, explicit)
Work View local ief_supplied 
count
Work View local employee 
job_grade
ENTITY ACTIONS:
Entity View employee
number
job_grade