Focal Point
Suppress decimal if zero

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/8381018932

August 01, 2007, 09:07 PM
dballest
Suppress decimal if zero
I have a compute field as:

COMPUTE NEWF2BUDGETYIELD/D20.1 = F2BUDGETYIELD * 100;

Now, it always displays the result as defined:

Value: 99
Display: 99.0

Value: 99.5
Display: 99.5

Is there a way to suppress the decimal portion of it is zero (99 instead of 99.0)?

Thanks,
Dan


Dev: WebFOCUS 7.6.10, Data Migrator 7.6.10
QA: WebFOCUS 7.6.10, Data Migrator 7.6.10
Prod: WebFOCUS 7.6.2, Data Migrator 7.6.8
Windows 2K3, Tomcat 5.5.17, IIS 6
Usage: HTML, PDF, Excel, Self-serve, BID and MRE
August 02, 2007, 03:10 AM
FrankDutch
Take a look at the discussion "creating dynamically formatted fields"

and see this example

DEFINE FILE CAR
MYFORMAT/A8=DECODE COUNTRY ('ENGLAND' 'P15.2C' 'JAPAN' 'P15' ELSE 'P15.2M');
END

TABLE FILE CAR
SUM SALES/MYFORMAT 
BY COUNTRY
END


that does whta you need...




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

August 02, 2007, 04:53 AM
Alan B
Frank is correct, and to get this to work on COMPUTED fields needs an extra step:
TABLE FILE CAR
SUM RCOST DCOST
COMPUTE 
PCT/D12.2 = ((RCOST-DCOST)/DCOST)*100; NOPRINT
FMT/A8 = IF INT(PCT) EQ PCT THEN 'F3' ELSE 'F4.1'; NOPRINT
PCT/FMT
BY COUNTRY
BY CAR
END
However that right justifies and looks bad IMO.

TABLE FILE CAR
SUM RCOST DCOST
COMPUTE 
PCT/D12.2 = ((RCOST-DCOST)/DCOST)*100; NOPRINT
ALPHA1/A6 = FTOA(PCT,'(D5.1)','A6'); NOPRINT
ALPHA2/A6 = FTOA(PCT,'(D5)','A6'); NOPRINT
DISPLAY/A6 = IF INT(PCT) EQ PCT THEN ALPHA2 ELSE ALPHA1;
BY COUNTRY
BY CAR

may well work for you.


Alan.
WF 7.705/8.007
August 02, 2007, 12:39 PM
dballest
Thanks Frank and Alan for your suggestions. I was able to get my results using Alan's first example.


Dev: WebFOCUS 7.6.10, Data Migrator 7.6.10
QA: WebFOCUS 7.6.10, Data Migrator 7.6.10
Prod: WebFOCUS 7.6.2, Data Migrator 7.6.8
Windows 2K3, Tomcat 5.5.17, IIS 6
Usage: HTML, PDF, Excel, Self-serve, BID and MRE