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 email@example.com for further assistance. Reference the community FAQ to learn more about the community.
TABLE FILE CAR
COMPUTE SALES_PLUS/A21=IF PCT.SALES GT 0 THEN '+'|SALES_TXT ELSE '-'|SALES_TXT;
Ram, a made a tiny adjustment to your sample code because a double minus sign is displayed when a value is negative (i.e. --20.00%) and a value of 0 is displayed as -0.00% which may or may not be desired.
TABLE FILE CAR
COMPUTE PCT_SALES/D20.2 = IF COUNTRY EQ 'JAPAN' THEN -1 * PCT.SALES ELSE PCT.SALES; NOPRINT
COMPUTE SALES_TXT/A20=FTOA(PCT_SALES,'(D12.2%)', SALES_TXT);
COMPUTE SALES_PLUS/A21=IF PCT_SALES GT 0 THEN '+' | SALES_TXT ELSE SALES_TXT;
But since it's not a numeric field anymore I can not use any kind of Totals
You're right about that. You cannot RECOMPUTE nor SUMMARIZE the percentage because it is now a text field but what you can do is using a RECAP to calculate the total variance and then a SUBFOOT to display it along with any other totals you need. I know, that's a little extra work and you won't get nice borders around your subfoot components but hey, at least the +/- signs are going to be there
The COMPUTE is simply a means to produce a couple of negative numbers in the output. Since the percentage column contains only numerics during the WebFOCUS processing phase, you can still SUMMARIZE the column.
DEFINE FILE CAR
SALES/D12.2 = SALES ;
TABLE FILE CAR
SUM PCT.SALES NOPRINT
AND COMPUTE PCTSALES/D6.1% = IF (PCT.SALES LE 15) THEN (-1 * PCT.SALES) ELSE PCT.SALES ; AS 'Sales %'
BY COUNTRY AS 'Country'
BY CAR AS 'Car'
ON TABLE SUMMARIZE
ON TABLE HOLD FORMAT HTMTABLE
var td = document.getElementsByTagName('td'); /* search for 'td' HTML tags */
for (i=0; i<td.length; i++) /* for instances where a td tag is found... */
if (td[i].innerHTML.indexOf('%') >= 0 && /* if the HTML text after the td tag contains '%' */
td[i].innerHTML.indexOf('-') != 0 && /* but not '-', to exclude negative values */
td[i].innerHTML.indexOf('0.0') != 0 && /* and not '0.0', to exclude zero values */
td[i].innerHTML.indexOf('100') != 0 && /* and not '100', to exclude the total */
td[i].innerHTML.indexOf('Sales') != 0) /* and not 'Sales', to exclude the column title */
td[i].innerHTML = '+' + td[i].innerHTML ; /* then add '+' to the front of the HTML text */
i agree, Dave LEAD='+' TRAIL='%' and my favorite... TRAIL='pp' (for second differences) are features in a very old econometric model building software that i used...it went away along with the economy... but it was bliss on a stick!
In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003
SET CURRSYMB ='+' -RUN DEFINE FILE CAR NSEATS/D10.2= IF COUNTRY EQ 'ENGLAND' THEN SEATS *(-1) ELSE SEATS; AFMT/A8=IF NSEATS GT -.00001 THEN 'D10.2M' ELSE 'D10.2' END TABLE FILE CAR SUM NSEATS/AFMT BY MODEL END
Tiny bit of a problem with totals and subtotals: since the format of the subtotal field is taken from the previous row's field when using dynamic formatting - when the last row is negative the + currency symbol is not displayed.
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server