Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED]Calculate the total for distinct columns

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]Calculate the total for distinct columns
 Login/Join
 
Platinum Member
posted
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!

Pondog

This message has been edited. Last edited by: Pondog,


WebFOCUS 8.1.05
Windows, All Outputs
 
Posts: 116 | Location: Birmingham, Al | Registered: July 23, 2015Report This Post
Virtuoso
posted Hide Post
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 FORMULA

This message has been edited. Last edited by: BabakNYC,


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Virtuoso
posted Hide Post
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

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Virtuoso
posted Hide Post
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
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Platinum Member
posted Hide Post
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
 
Posts: 116 | Location: Birmingham, Al | Registered: July 23, 2015Report This Post
Virtuoso
posted Hide Post
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
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Platinum Member
posted Hide Post
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
 
Posts: 116 | Location: Birmingham, Al | Registered: July 23, 2015Report This Post
Platinum Member
posted Hide Post
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


Thanks to all who helped!


WebFOCUS 8.1.05
Windows, All Outputs
 
Posts: 116 | Location: Birmingham, Al | Registered: July 23, 2015Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED]Calculate the total for distinct columns

Copyright © 1996-2020 Information Builders