APP PATH IBISAMP -RUN TABLE FILE CAR SUM DEALER_COST AS 'D_C_COUNTRY' BY COUNTRY NOPRINT SUM DEALER_COST AS 'D_C_CAR' BY COUNTRY BY CAR ON TABLE HOLD ON TABLE SET ASNAMES ON END -RUN TABLE FILE HOLD PRINT D_C_CAR AS 'DEALER_COST' COMPUTE PERCENTAGE_1/D20.2%=D_C_CAR*100/D_C_COUNTRY; AS 'PERCENTAGE' BY D_C_COUNTRY BY CAR ON TABLE PCHOLD FORMAT HTML END
TABLE FILE GGSALES SUM DOLLARS PCT.DOLLARS WITHIN REGION BY REGION BY STCD END
-* WebFOCUS Version used: 8.0.06 DEFINE FILE EMPDATA FULLNAME/A100 = LASTNAME || (', ' | FIRSTNAME); END TABLE FILE EMPDATA -* Get the total at the right sort level that you wish to use as the divisor -* but NOPRINT it as we don't want to see it in the report SUM SALARY NOPRINT BY DEPT -* Now we can reference that report field using column notation, -* this is the first non sort field so the notation is C1 SUM SALARY COMPUTE PERCENTAGE/D6.2% = SALARY / C1 * 100; BY DEPT BY FULLNAME -* Let us show the total being used in the percentage calculation in a subtotal for the sort value ON DEPT SUBTOTAL AS '*' -* As we're using a computed percentage, we need to use RECOMPUTE on the grandtotal -* Try it with and without to see the difference that it makes .... ON TABLE RECOMPUTE -* This line turns of paging essentially ON TABLE SET LINES 999999 -* This line turns off the automatic page numbering and some of the leading blank line(s) ON TABLE SET PAGE NOLEAD ON TABLE PCHOLD FORMAT HTML ON TABLE SET STYLE * SIZE=9, FONT=ARIAL, SQUEEZE=ON, GRID=OFF, $ ENDSTYLE END
In FOCUS since 1986 | WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2 | ||
WebFOCUS App Studio 8.2.06 standalone on Windows 10 |
quote:best use of WITHIN
DEFINE FILE EMPDATA FULLNAME/A100 = LASTNAME || (', ' | FIRSTNAME); END TABLE FILE EMPDATA SUM SALARY PCT.SALARY/D6.2% WITHIN DEPT BY DEPT BY FULLNAME ON DEPT SUBTOTAL AS '*' -* None of these produce the correct percentage .... -*ON TABLE SUBTOTAL -*ON TABLE SUMMARIZE -*ON TABLE RECOMPUTE ON TABLE COLUMN-TOTAL ON TABLE SET LINES 999999 ON TABLE SET PAGE NOLEAD ON TABLE PCHOLD FORMAT HTML ON TABLE SET STYLE * SIZE=9, FONT=ARIAL, SQUEEZE=ON, GRID=OFF, $ ENDSTYLE END
In FOCUS since 1986 | WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2 | ||
WebFOCUS App Studio 8.2.06 standalone on Windows 10 |
In FOCUS since 1986 | WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2 | ||
WebFOCUS App Studio 8.2.06 standalone on Windows 10 |
quote:I missed that requirment
In FOCUS since 1986 | WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2 | ||
WebFOCUS App Studio 8.2.06 standalone on Windows 10 |