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.
I have a dilemma when trying to add column totals to a report. I have 3 columns on a report as you can see in the code below. 2 totals and a percent.
In the column totals, it calculates the totals for the first 2 columns just fine, but when it goes to calculate the percent total, it doesn't recalculate based upon the compute defined in the report. It merely sums the percentages up. How can I get my column totals to display the correct percentage values?
TABLE FILE SALES
SUM
COMPUTE SALES/D12.2!D = RETAIL_PRICE * UNIT_SOLD; AS 'Sales'
UNIT_SOLD AS 'Units'
COMPUTE SALES_PCT/D12.2% = ( UNIT_SOLD / SALES ) * 100; AS '% of Sales'
BY CITY
ON TABLE COLUMN-TOTAL AS 'TOTAL'
END
Results:
CITY Sales Units % of Sales
NEW YORK $1,764.18 162 9.18%
NEWARK $104.16 42 40.32%
STAMFORD $4,805.28 376 7.82%
UNIONDALE $297.70 65 21.83%
TOTAL $6,971.32 645 79.16%
The total for the "% of Sales" column should not be 79.16%. It should be 9.25%.
Nevermind all...I got it to work by adding ON TABLE SUMMARIZE.
TABLE FILE SALES
SUM
COMPUTE SALES/D12.2!D = RETAIL_PRICE * UNIT_SOLD; AS 'Sales'
UNIT_SOLD AS 'Units'
COMPUTE SALES_PCT/D12.2% = ( UNIT_SOLD / SALES ) * 100; AS '% of Sales'
BY CITY
ON TABLE SUMMARIZE
END
As simplistic as this was based on your example, I have found that MOST of the time, reports are a bit more complex and SUMMARIZE/RECOMPUTE won't suffice. So, I am a true believer in RECAP/SUBFOOT, especially when needing to style.
Here's an example, based on your SALES code:
DEFINE FILE SALES
DUMMY/A1 = ' ';
END
TABLE FILE SALES
SUM
COMPUTE SALES/D12.2!D = RETAIL_PRICE * UNIT_SOLD; AS 'Sales'
UNIT_SOLD AS 'Units'
COMPUTE SALES_PCT/D12.2% = ( UNIT_SOLD / SALES ) * 100; AS '% of Sales'
BY DUMMY NOPRINT
BY CITY
ON DUMMY RECAP
XSALES/D12.2!D = SALES;
XUNITS/I6 = UNIT_SOLD;
XPCT/D12.2% = (XUNITS / XSALES) * 100;
ON DUMMY SUBFOOT
"Total<XSALES<XUNITS<XPCT"
ON TABLE SET STYLE *
UNITS=IN, SQUEEZE=ON, ORIENTATION=PORTRAIT,$
TYPE=REPORT,
SQUEEZE=ON, GRID=ON, WRAP=ON, FONT='ARIAL', SIZE=9, STYLE=BOLD,$
-********************************************************************
-* Align the TOTALS
-********************************************************************
TYPE=SUBFOOT,
BACKCOLOR=RGB(176 196 222), HEADALIGN=BODY, JUSTIFY=RIGHT,$
TYPE=SUBFOOT,
ITEM=1, JUSTIFY=LEFT,$
END
-EXIT
Just showing there is another way up the WF mountain.