I'm putting information into an Excel template. The data is 10 columns long and the number of rows will vary. At the bottom I need to have the column totals for the 8th and 9th columns; not for all the columns. underneath the column total for the 9th column I need a calculated value (percentage) of the 8th/9th. Is this something that is possible?
I also need to have a "Totals" label and a "Percentage" label. I'm trying to duplicate an Excel spreadsheet that I'm setting up for automation. Any advice would be appreciated!
PondogThis message has been edited. Last edited by: Pondog,
WebFOCUS 8.1.05 Windows, All Outputs
January 20, 2016, 12:43 PM
BabakNYC
To create column totals for specific columns you have to add the name of the column you want to total to the line as follows: ON TABLE COLUMN-TOTAL AS 'GRAND TOTAL' DCOST
TABLE FILE CAR SUM CAR.BODY.DEALER_COST CAR.BODY.RETAIL_COST COMPUTE PERC/D12.2% = DCOST*100/RCOST; NOPRINT BY CAR.ORIGIN.COUNTRY BY CAR.COMP.CAR BY CAR.CARREC.MODEL FOOTING '' ON TABLE SET PAGE-NUM NOLEAD ON TABLE SET ASNAMES ON ON TABLE COLUMN-TOTAL AS 'GRAND TOTAL' DCOST ON TABLE PCHOLD FORMAT HTML ON TABLE SET HTMLEMBEDIMG ON ON TABLE SET HTMLCSS ON ON TABLE SET STYLE * INCLUDE = endeflt, $ TYPE=FOOTING, LINE=1, OBJECT=TEXT, ITEM=1, JUSTIFY=LEFT, WIDTH=1.000, $ TYPE=FOOTING, LINE=1, OBJECT=FIELD, ITEM=1, JUSTIFY=RIGHT, WIDTH=4.375, $ ENDSTYLE END
You can change the format to Excel with: ON TABLE PCHOLD FORMAT XLSX FORMULAThis message has been edited. Last edited by: BabakNYC,
WebFOCUS 8206, Unix, Windows
January 20, 2016, 12:54 PM
Danny-SRL
For the totals, you can use a command like ON TABLE SUMMARIZE or COLUMN-TOTAL. For the ratio, use a RECAP and then a SUBFOOT.
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
January 20, 2016, 01:06 PM
BabakNYC
The line in my FOOTING got messed up by HTML. It should read: FOOTING DOUBLE QUOTE LEFT BRACKET PERC DOUBLE QUOTE
WebFOCUS 8206, Unix, Windows
January 20, 2016, 01:31 PM
Pondog
My apologies for not stating my situation clearly. I'm using an SQL query in the report that pulls the information in the order I need. From there I only need to print the information; no "BY" statements. I tried using SUBFOOT, but was understanding I needed a "BY" which I'm not using.
I'll research the COLUMN-TOTAL and FOOTING COMMANDS. Thanks a bunch for the advice!
WebFOCUS 8.1.05 Windows, All Outputs
January 20, 2016, 01:41 PM
BabakNYC
You are allowed to use ON TABLE SUBFOOT. BY isn't required. However, the code above should work against SQLOUT as well.
By the way, if your data is in the order you want, try using TABLEF instead of TABLE. Depending on the size of the table, you might get a little better performance.This message has been edited. Last edited by: BabakNYC,
WebFOCUS 8206, Unix, Windows
January 25, 2016, 05:39 PM
Pondog
I've done some research and edited my code. It runs, but there's nothing there. I get a total at the bottom of columns 8 and nine, however, I don't get a subfoot under them for the percentage. I get the label in the footing, but no value. What am I missing?
TABLE FILE SQLOUT
PRINT
PROVIDER AS 'Prv#'
PROVNAME AS 'Provider Name'
PATMRN AS 'MRN'
SCHEDDATE AS 'First Date ,Scheduled'
APPTDATE AS 'Appt Date'
PRVTYPEMNE AS 'Appt Type'
APPTTIME AS 'Appt Time'
NEWARRIVED AS 'Total New Arrived'
NEWARR14 AS 'New Arrived,w/i 14 Days'
COLUMN0000 AS 'Days to,ARR''d'
FOOTING
"%ARR w/i 14 days:"
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE COLUMN-TOTAL AS 'TOTALS:' NEWARRIVED
ON TABLE COLUMN-TOTAL AS '' NEWARR14
ON TABLE RECAP
ARR_CALC/D3.1 = SUM.NEWARRIVED/SUM.NEWARR14;
ON TABLE SUBFOOT
ON TABLE PCHOLD FORMAT XLSX TEMPLATE 'anesth_monthly2.xltx' SHEETNUMBER 1
ON TABLE SET STYLE *
INCLUDE = IBFS:/WFC/Repository/Branding/np_gphc_theme.sty,
$
ENDSTYLE
END
WebFOCUS 8.1.05 Windows, All Outputs
February 03, 2016, 09:57 AM
Pondog
Thanks to CoolGuy I was able to resolve the issue of using two column totals in another calculation. Here's the portion of the code that worked.
PRINT
"VARIOUS COLUMNS HERE"
COMPUTE AVGCALC/P3.1% = (TOT.NEWARR14 / TOT.NEWARRIVED)*100; NOPRINT
FOOTING
"<+0><+0><+0><+0><+0><+0><+0>%ARR w/i 14 days: <AVGCALC"
ON TABLE COLUMN-TOTAL AS 'TOTALS:' 'NEWARRIVED' 'NEWARR14'
ON TABLE VARIOUS OTHER CODE HERE