SUPER NATURAL
CONTROL BREAKS FOR TOTALS AND COUNTS

Many times you may need to provide information at breaks or changes in the data. For example, a report of all majors in the college of business may require a subtotal indicating how many students are in each major. Super Natural provides for "Control Breaks" to identify where to report subtotals.

Identify the field(s) on which you will perform a system function when the value of that field changes. Mark that field with a C in the S/C column. In this example, we will perform some arithmetic functions whenever the primary degree changes.

SNCLASS                          - Worksheet -                           SN3011
                                                                               
Ref DB    Field Name                         Seq   S/C  Func Def  Info Del     
AA  1S    RTKEY-TERM-SID .................   ___   ___   __   __   __   __     
AB  1S*   CLASS-ROSTER ...................   ___   ___   __   __   __   __     
AC  1S    TERM-COLLEGE ...................   ___   ___   __   __   __   __     
AD  1S    TERM-DEGREE ....................   ___   ___   __   __   __   __     
AE  1S    TERM-MAJOR .....................   ___   ___   __   __   __   __     
AF  1S    TERM-ACAD-ACT ..................   ___   ___   __   __   __   __     
AH  1  2  RT005-TERM-CODE ................   1__   ___   __   __   __   __     
AI  1  2  RT010-SID ......................   2__   S2_   __   __   __   __     
AJ  1  2  RT020-CUR-RHRS .................   5__   ___   __   __   __   __     
AQ  1  2  RT105-PRI-COLLEGE ..............   ___   ___   __   __   __   __     
AR  1  2  RT115-PRI-DEGREE ...............   3__   C1_   __   __   __   __     
AS  1  2  RT120-PRI-MAJOR1 ...............   4__   ___   __   __   __   __     
DE        ________________________________   ___   ___   __   __   __   __     
DF        ________________________________   ___   ___   __   __   __   __     
                                                                               
Command ===>                                                                   
Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
      Help  Next  Exit  Field Incl  Flip    -     +         Sel   Run   Canc   

The C in the S/C column defines the control break. The 1 indicates level one. This tells Super Natural that you want the report to be sorted on degree and that you want to report subtotals when the value of degree changes. Notice that a sort is also specified on RT010-SID. This will cause the records to be sorted in student ID order. The 2 indicates level 2 which is necessary because the control break is an implied sort and it is at level 1.

The next step is to identify what functions you want to perform when the value of the degree changes. Super Natural provides 9 system functions that can be reported at a control break. These are:

Count - count of records
Total - cumulative total of a numeric field
Sum - total of a numeric field since the last break
Average - average of values
Maximum - maximum value
Minimum - minimum value
N Count - count of records excluding zero values
N Avg - average of values excluding zero values
N Min - minimum value excluding zero values

To assign one or more of these functions to a field, use the SF command in the Func column next to the field. For example, suppose we want a count of the number of students with each degree. We need to count the SID's. Type SF in the Func column of the RT010-SID field and press Enter.

SNCLASS                          - Worksheet -                           SN3011
                                                                               
Ref DB    Field Name                         Seq   S/C  Func Def  Info Del     
AA  1S    RTKEY-TERM-SID .................   ___   ___   __   __   __   __     
AB  1S*   CLASS-ROSTER ...................   ___   ___   __   __   __   __     
AC  1S    TERM-COLLEGE ...................   ___   ___   __   __   __   __     
AD  1S    TERM-DEGREE ....................   ___   ___   __   __   __   __     
AE  1S    TERM-MAJOR .....................   ___   ___   __   __   __   __     
AF  1S    TERM-ACAD-ACT ..................   ___   ___   __   __   __   __     
AH  1  2  RT005-TERM-CODE ................   1__   ___   __   __   __   __     
AI  1  2  RT010-SID ......................   2__   S2_   SF   __   __   __     
AJ  1  2  RT020-CUR-RHRS .................   5__   ___   __   __   __   __     
AQ  1  2  RT105-PRI-COLLEGE ..............   ___   ___   __   __   __   __     
AR  1  2  RT115-PRI-DEGREE ...............   3__   C1_   __   __   __   __     
AS  1  2  RT120-PRI-MAJOR1 ...............   4__   ___   __   __   __   __     
DE        ________________________________   ___   ___   __   __   __   __     
DF        ________________________________   ___   ___   __   __   __   __     
                                                                               
Command ===>                                                                   
Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
      Help  Next  Exit  Field Incl  Flip    -     +         Sel   Run   Canc   

The following window appears. Mark each function with an X to be performed at each break point, or at the end of the report. We want a count at each breakpoint, and also a count at the end of the report, so our system functions for the SID field will look like this:
*************************** Specify System Functions ***************************
*  Field: RT010-SID                                                             *
*                                                                   N   N   N   *
*  Level  Control Field                    Cnt Tot Sum Avg Max Min Cnt Avg Min  *
*  Grand  End of Report                     X               _   _   _       _   *
*      1  RT115-PRI-DEGREE                  X               _   _   _       _   *
*                                           _               _   _   _       _   *
*                                           _               _   _   _       _   *
*                                           _               _   _   _       _   *
*                                           _               _   _   _       _   *
*                                           _               _   _   _       _   *
*                                                                               *
*********************************************************************************
Press Enter when done to exit the System Functions window. A right angle bracket appears in the Func column to designate that a system function has been on that field. The results of this transaction would look like this:
     TERM     SID     DEGREE  PRI     REG       
                             MAJOR   HOURS      
     ---- ----------- ------ ----- ----------   
                                                
     96F  001-43-1004 BAAS   MATH        3.00   
     96F  001-43-1005 BAAS   MATH        0.00   
     96F  001-43-1007 BAAS   MATH        0.00   
     96F  001-43-1008 BAAS   MATH        3.00   
     96F  001-43-1009 BAAS   MATH        0.00   
     96F  001-43-1010 BAAS   MATH        3.00   
     96F  001-43-1011 BAAS   MATH        3.00   
     96F  001-43-1012 BAAS   MATH        3.00   
     96F  001-43-1013 BAAS   MATH        0.00   
     96F  001-43-1020 BAAS   MATH        9.00   
     96F  137-72-4130 BAAS   MATH        0.00   
     96F  153-42-8219 BAAS   MATH        3.00   
** Control Break (1) **                           
     DEGREE :  BAAS                               
Cnt            12                                 
                                                  
     96F  001-43-1006 BSAS   MATH        0.00     
     96F  001-43-1021 BSAS   MATH        0.00     
     96F  052-34-7597 BSAS   MATH       12.00     
     96F  433-04-6624 BSAS   MATH        0.00     
** Control Break (1) **                           
     DEGREE :  BSAS                               
Cnt             4                                 

** Grand Totals **    
Cnt            16     
                      

Some arithmetic functions had been disabled in the previous example since the fields we have chosen are alphanumeric fields. The arithmetic system functions may only be performed on numeric fields. In this example, we'll generate some statistics on the Registered Hours field (RT020-CUR-RHRS). Type SF in the Func column of the RT020-CUR-RHRS field. Mark the system functions as follows:

*************************** Specify System Functions ***************************
*  Field: RT020-CUR-RHRS                                                       *
*                                                                   N   N   N  *
*  Level  Control Field                    Cnt Tot Sum Avg Max Min Cnt Avg Min *
*  Grand  End of Report                     _   X   X   X   X   X   X   X   X  *
*      1  RT115-PRI-DEGREE                  _   X   X   X   X   X   X   X   X  *
*                                           _   _   _   _   _   _   _   _   _  *
*                                           _   _   _   _   _   _   _   _   _  *
*                                           _   _   _   _   _   _   _   _   _  *
*                                           _   _   _   _   _   _   _   _   _  *
*                                           _   _   _   _   _   _   _   _   _  *
*                                                                              *
********************************************************************************
This would yeild the following results:
     TERM     SID     DEGREE  PRI     REG          
                             MAJOR   HOURS         
     ---- ----------- ------ ----- ----------      
                                                   
     96F  001-43-1004 BAAS   MATH        3.00      
     96F  001-43-1005 BAAS   MATH        0.00      
     96F  001-43-1007 BAAS   MATH        0.00      
     96F  001-43-1008 BAAS   MATH        3.00      
     96F  001-43-1009 BAAS   MATH        0.00      
     96F  001-43-1010 BAAS   MATH        3.00      
     96F  001-43-1011 BAAS   MATH        3.00      
     96F  001-43-1012 BAAS   MATH        3.00      
     96F  001-43-1013 BAAS   MATH        0.00      
     96F  001-43-1020 BAAS   MATH        9.00      
     96F  137-72-4130 BAAS   MATH        0.00      
     96F  153-42-8219 BAAS   MATH        3.00      
** Control Break (1) **                            
     DEGREE :  BAAS                                
Cnt            12                                  
Tot                                     27.00      
Sum                                     27.00      
Avg                                      2.25      
Max                                      9.00      
Min                                      0.00      
NCnt                                      7        
NAvg                                     3.85      
NMin                                     3.00      
                                                   
     96F  001-43-1006 BSAS   MATH        0.00      
     96F  001-43-1021 BSAS   MATH        0.00     
     96F  052-34-7597 BSAS   MATH       12.00     
     96F  433-04-6624 BSAS   MATH        0.00     
** Control Break (1) **                         
     DEGREE :  BSAS                             
Cnt             4                               
Tot                                     39.00   
Sum                                     12.00   
Avg                                      3.00   
Max                                     12.00   
Min                                      0.00   
NCnt                                      1     
NAvg                                    12.00   
NMin                                    12.00   

** Grand Totals **                             
Cnt            16                              
Tot                                     39.00  
Sum                                     39.00  
Avg                                      2.43  
Max                                     12.00  
Min                                      0.00  
NCnt                                      8    
NAvg                                     4.87  
NMin                                     3.00  
                                               
 *** End of report ***                    
                                          
 Number of records processed: = 16        
                                          
The count appears under the SID column, since that is the column where we placed that function (in the first example). The other functions appear under the Registered Hours field, as we designated.
Forward to: Changing Column Headings

Back to: Super Natural Home Page