Focal Point
Split a subtotal into to two subtotals

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/1307068506

June 22, 2011, 03:55 PM
Charles Richards
Split a subtotal into to two subtotals
Is there a way to split a subtotal into 2 seperate parts based on a subvalue, Lets say department A has to sub sections a and b... i would like to split into those two sections but the total for the department as a whole would remain the same

Ex.

Department_____Class_____Sales
A______________1_________250.00
A______________1_________100.00
Subtotal of 1
percent of department 35%

A______________2_________50.00
A______________2_________25.00
A______________2_________25.00
Subtotal of 2
percent of department 10%


A______________3_________150.00
A______________3_________50.00
A______________3_________50.00
Subtotal of 3
percent of department 20%


A______________4_________100.00
A______________4_________200.00
Subtotal of 4
percent of department 30%

Subtotal of Department Aa <------
Total Sales

Subtotal of Department Ab <------
Total Sales


B______________1_________100.00
B______________1_________50.00
Etc...


WebFOCUS 7.6
Windows, All Outputs
June 23, 2011, 11:24 AM
Doug
You should be able to create (DEFINE) "buckets" for those "sub sections" and subtotal on them and department.
June 24, 2011, 11:12 AM
Charles Richards
Could you expand upon what you have said, im not quite positive on how to achieve that.

Also this would be only for on subtotal, all the rest would remain the same

Thanks for the help!


WebFOCUS 7.6
Windows, All Outputs
June 24, 2011, 04:56 PM
<FreSte>
Maybe something like this ?

-* -------------------------------------------------------------------------------------
-* Create MASTER / DATA files
-* -------------------------------------------------------------------------------------
APP FI HLDFILE DISK hldfile.mas
-RUN
-WRITE HLDFILE SEGMENT=HLDFILE, SEGTYPE=S0, $
-WRITE HLDFILE  FIELDNAME=DEP        ,E01 ,A5     ,ACTUAL=A5 ,$
-WRITE HLDFILE  FIELDNAME=CLASS      ,E02 ,A1     ,ACTUAL=A1 ,$
-WRITE HLDFILE  FIELDNAME=SALES      ,E03 ,I9C    ,ACTUAL=A9  ,$

APP FI HLDFILE DISK hldfile.ftm
-RUN
-WRITE HLDFILE DepA 1      250
-WRITE HLDFILE DepA 1      100
-WRITE HLDFILE DepA 2       50
-WRITE HLDFILE DepA 2       25
-WRITE HLDFILE DepA 2       25
-WRITE HLDFILE DepA 3      150
-WRITE HLDFILE DepA 3       50
-WRITE HLDFILE DepA 3       50
-WRITE HLDFILE DepA 4      100
-WRITE HLDFILE DepA 4      200
-WRITE HLDFILE DepB 1      100
-WRITE HLDFILE DepB 1       50
-* -------------------------------------------------------------------------------------


TABLE FILE HLDFILE
  SUM
    SALES  NOPRINT
  BY DEP
  PRINT
    SALES  AS 'Sales'
    COMPUTE PCT2/D8.2% = (SALES/C1) * 100; NOPRINT
  BY DEP   AS 'Department' COLUMN-TOTAL
  BY CLASS AS 'Class'      SUBTOTAL AS 'Subtotal of '
  ON CLASS SUBFOOT
  "Percent of Department: <ST.PCT2 "
  " "
  ON TABLE SET HTMLCSS ON
  ON TABLE SET PAGE NOPAGE
  ON TABLE NOTOTAL
  ON TABLE SET BYDISPLAY ON

ON TABLE SET STYLE *
TYPE=REPORT     ,UNITS=PTS   ,FONT='VERDANA', SIZE=8        ,$
TYPE=REPORT     ,BORDER=1    ,BORDER-COLOR=RGB(210 210 210) ,$
TYPE=TITLE      ,STYLE=BOLD  ,BACKCOLOR=RGB(230 230 230)    ,$
TYPE=SUBFOOT    ,STYLE=BOLD  ,line=1 ,$
TYPE=SUBTOTAL   ,STYLE=BOLD  ,BACKCOLOR=RGB(210 210 210)    ,$
TYPE=DATA       ,TOPGAP=2    ,BOTTOMGAP=2                   ,$
TYPE=DATA       ,BACKCOLOR=(RGB(255 255 255) RGB(245 245 245)),$
ENDSTYLE
END



... or ...

TABLE FILE HLDFILE
  SUM
    SALES NOPRINT
  BY DEP
  PRINT
    SALES  AS 'Sales'
    COMPUTE ST_SALES/I9C = SALES; NOPRINT
    COMPUTE PCT2/D8.2%   = (SALES/C1) * 100; NOPRINT
  BY DEP   AS 'Department'
  BY CLASS AS 'Class'      PAGE-BREAK

  ON CLASS SUBFOOT
  "Subtotal <0> <0><ST.ST_SALES "
  "Percent of Department:<+0> <+0><ST.PCT2 "
  ON TABLE SET HTMLCSS ON
  ON TABLE SET PAGE NOPAGE
  ON TABLE NOTOTAL
  ON TABLE SET BYDISPLAY ON

  ON TABLE SET STYLE *
    TYPE=REPORT   ,UNITS=PTS         ,FONT='VERDANA', SIZE=8          ,$
    TYPE=REPORT   ,BORDER=0          ,BORDER-COLOR=RGB(210 210 210)   ,$
    TYPE=TITLE    ,STYLE=BOLD        ,BORDER-TOP=2, BORDER-BOTTOM=1,
                                      BACKCOLOR=RGB(230 230 230)      ,$
    TYPE=SUBFOOT  ,HEADALIGN=BODY                                     ,$
    TYPE=SUBFOOT  ,STYLE=BOLD+ITALIC ,BORDER-TOP=0 ,BORDER-RIGHT=0    ,$
    TYPE=SUBFOOT  ,OBJECT=FIELD      ,STYLE=BOLD, JUSTIFY=RIGHT       ,$
    TYPE=DATA     ,COLUMN=CLASS      ,JUSTIFY=CENTER                  ,$
    TYPE=DATA     ,TOPGAP=2          ,BOTTOMGAP=2                     ,$
  ENDSTYLE
END

This message has been edited. Last edited by: <FreSte>,
June 27, 2011, 09:13 AM
Charles Richards
I was trying to look at this code and find out where department A was split into 2 subsections lowercase a and b. Where in the code was department A split into 2 subsections a and b?

thanks for the reply!


WebFOCUS 7.6
Windows, All Outputs
June 27, 2011, 10:01 AM
<FreSte>
After re-reading the question, I see what you mean; I missed the lowercase one's in my example.
Can you expand the dataset above with what you mean and the expected output ?
June 27, 2011, 10:39 AM
Charles Richards
Department_____Class_____Sales
A______________1_________250.00
A______________1_________100.00
Subtotal of 1
percent of department 35%
part of subdepartment a

A______________2_________50.00
A______________2_________25.00
A______________2_________25.00
Subtotal of 2
percent of department 10%
part of subdepartment b


A______________3_________150.00
A______________3_________50.00
A______________3_________50.00
Subtotal of 3
percent of department 20%
part of subdepartment a

A______________4_________100.00
A______________4_________200.00
Subtotal of 4
percent of department 30%
part of subdepartment a

Subtotal of Department A

subdepartment a <------
Total Sales

subdepartment b <------
Total Sales


B______________1_________100.00
B______________1_________50.00
Etc...

I hope this clarifies a little

each part of department A has a subdepartment
eaither a or b

and when i go to subtotal department A
i would like to further break it down into subdepartment a or b

thanks for the help!


WebFOCUS 7.6
Windows, All Outputs
June 28, 2011, 03:18 AM
<FreSte>
Maybe it cannot be done in 1 run, but it will help if you could expand the above mentioned data structure on how the subdepartments fit in.
Are the subdepartments making the totals for each Department/Class ??

-WRITE HLDFILE DepA 1      250 ....
-WRITE HLDFILE DepA 1      100 .... ??
....

June 28, 2011, 11:34 AM
Charles Richards
To explain to better, its the department called candy-tabbacco and what i would like to do is instead of totaling it all in one, i would like to split it and total the tabacco and the candy seperate at the end of the department candy-tabacco

subdepartment = t for tabacco
subdepartment = c for candy


WebFOCUS 7.6
Windows, All Outputs