[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference ilbbak::ibi_focus

Title:FOCUS, from INFORMATION BUILDERS
Moderator:ZAYIUS::BROUILLETTE
Created:Thu Feb 19 1987
Last Modified:Mon May 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:615
Total number of notes:1779

157.0. "Problems with SUBTOTAL" by EFGV01::LEE () Wed Nov 23 1988 09:32

I have been using 

   BY field SUBTOTAL numeric-field-x numeric-field-y 

to subtotal just a (selected) subset of the numeric fields that I 
have PRINT'ed.

Now I have numeric fields printed by a largish number of BY fields,
and on different sort-breaks I want to SUBTOTAL different numeric
fields. ie. On different sort-breaks, some subtotals are more 
meaningful than others. 

This does not seem to be possible. Once I SUBTOTAL on (say a lower)
level sort-break, AND have a SUBTOTAL on any higher
sort-break, the whole lot of selected fields gets subtotalled 

Eg. What I do is:

TABLE FILE x
PRINT texta textb num1 num2 textc num3 textd num4
BY keyi SUBTOTAL  num1            num3
BY keyj SUBTOTAL       num2                  num4
BY keyk SUBTOTAL  num1 num2 
BY keyl SUBTOTAL  num1 num2       num3       num4 

At every sort-break I get subtotals for num1 num2 num3 num4

In fact, ALL sort-breaks with SUBTOTAL will produce subtotals 
for all fields selected in ANY sort-breaks with a SUBTOTAL. ie:

TABLE FILE x
PRINT texta textb num1 num2 textc num3 textd num4
BY keyi SUBTOTAL       num2      
BY keyj SUBTOTAL  num1                       num4
BY keyk SUBTOTAL  num1 num2 
BY keyl SUBTOTAL                  num3

also produces subtotals for all the fields num1 to num4 at every sort-break.

Is there a solution to this problem ? 

Note: This is not SUBTOTAL behaving like SUB-TOTAL. If the SUBTOTAL is
      omitted from a sort break, then none of the inner subtotals 'carry 
      up' into that sort break.

================================================================================

Examples:

X.DAT
-----

A#0101
A#0404
A$0505
A$0202
B#0202
B#0101
B$0606
B$0707

X.MAS
-----

FILENAME = SUBTOT ,SUFFIX = FIX ,$
SEGNAME = SUBTOT ,$                         
FIELDNAME = LETTER  ,ALIAS = ,USAGE = A1   ,ACTUAL = A1  ,$
FIELDNAME = SYMBOL  ,ALIAS = ,USAGE = A1   ,ACTUAL = A1  ,$
FIELDNAME = NUMBER1 ,ALIAS = ,USAGE = P4   ,ACTUAL = A2  ,$
FIELDNAME = NUMBER2 ,ALIAS = ,USAGE = P4   ,ACTUAL = A2  ,$

Eg 1. FEX & OUTPUT:
------------------

OFFLINE CLOSE
FILEDEF OFFLINE DISK X1.LIS
TABLE FILE X
PRINT              NUMBER1 NUMBER2
BY LETTER SUBTOTAL         NUMBER2 
BY SYMBOL SUBTOTAL NUMBER1 NUMBER2 
END

  LETTER  SYMBOL  NUMBER1  NUMBER2
  ------  ------  -------  -------
  A       #             1        1
                        4        4
 
  *TOTAL SYMBOL #
                        5        5
 
          $             5        5
                        2        2
 
  *TOTAL SYMBOL $
                        7        7
  *TOTAL LETTER A
                       12       12
 
  B       #             2        2
                        1        1
 
  *TOTAL SYMBOL #
                        3        3
 
          $             6        6
                        7        7
 
  *TOTAL SYMBOL $
                       13       13
  *TOTAL LETTER B
                       16       16
 
 
  TOTAL                28       28
 

Eg 2. FEX & OUTPUT:
------------------

OFFLINE CLOSE
FILEDEF OFFLINE DISK X2.LIS
TABLE FILE X
PRINT              NUMBER1 NUMBER2
BY LETTER SUBTOTAL NUMBER1 NUMBER2 
BY SYMBOL SUBTOTAL         NUMBER2 
END

  LETTER  SYMBOL  NUMBER1  NUMBER2
  ------  ------  -------  -------
  A       #             1        1
                        4        4
 
  *TOTAL SYMBOL #
                        5        5
 
          $             5        5
                        2        2
 
  *TOTAL SYMBOL $
                        7        7
  *TOTAL LETTER A
                       12       12
 
  B       #             2        2
                        1        1
 
  *TOTAL SYMBOL #
                        3        3
 
          $             6        6
                        7        7
 
  *TOTAL SYMBOL $
                       13       13
  *TOTAL LETTER B
                       16       16
 
 
  TOTAL                28       28
 
T.RTitleUserPersonal
Name
DateLines