Focal Point
FORMAT EXL2K FORMULA rounding problem

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

October 28, 2004, 06:02 PM
susannah
FORMAT EXL2K FORMULA rounding problem
has anyone been able to use
ON TABLE PCHOLD FORMAT EXL2K FORMULA
where the result of the compute has to be integer?
IT DOESN'T WORK! I NEED A WORK AROUND REAL BAD.
COMPUTE NEW/I8=OLD * SHARE; where share is some percentage.
The calculation statement comes out ok, but the cell format is not General or Number with no zeros...the cell format ..get this... is custom #;-#; which means 1. no negatives show and 2. the underlying value carries decimals even tho it doesn't display them. The COMPUTE statement cant use the ROUND function because ROUND isnt supported in webfocus (!)
October 28, 2004, 08:35 PM
Spence
See if this helps.

TABLE FILE CAR
SUM DEALER_COST
COMPUTE DEALER_PCT/D9.2 = DEALER_COST * .0125;
COMPUTE DEALER_PCT1/I8 = DEALER_PCT;
COMPUTE NODECPLACES/D9 = DEALER_PCT * 100;
COMPUTE DECPLACES/A2 = EDIT(NODECPLACES,'$$$$$$$99');
COMPUTE DEALER_PCT2/I8 = IF DECPLACES GE '50' THEN DEALER_PCT1 + 1 ELSE
DEALER_PCT1 + 0;
COLUMN-TOTAL
BY COUNTRY
BY CAR
ON TABLE HOLD
END
TABLE FILE HOLD
PRINT DEALER_COST
DEALER_PCT
DEALER_PCT1
DEALER_PCT2
COLUMN-TOTAL
BY COUNTRY
BY CAR
ON TABLE PCHOLD FORMAT EXL2K FORMULA
END
October 28, 2004, 08:42 PM
susannah
/I8 is still carried in excel with decimal values. Which is horrid.
and any interim fields needed to address that issue, as you suggest, can't be automatically Hidden. What i want is a way to write a character string that excel will evaluate as an executable statement.
Then i can do the ROUNDDOWN excel function.
I have to produce a clean working sheet.
October 31, 2004, 05:38 AM
Piipster
I tried the following ...

TABLE FILE EMPDATA
PRINT

SALARY
COMPUTE BONUS/D9.7 = .0173298;
COMPUTE
CALCI1/I8 =(SALARY * BONUS);

COMPUTE
CALCI2/I8 =INT(SALARY * BONUS);

BY PIN
ON TABLE HOLD AS TESTXL FORMAT EXL2K FORMULA
END


As an example this is what shows in the .xht file


X:NUM class=xl100r x:fmla="=$B9 *$C9 ">752 .../TD
X:NUM class=xl100r x:fmla="=TRUNC(($B9 *$C9 ))">752 .../TD
October 31, 2004, 11:09 PM
susannah
so, you're saying use an INT operator? hmm. very intetesting. i'll try it tomorrow. thanks.
aha! worked great! thank you.
COMPUTE NEW/I8S=INT(field1 * field2 + .499)
works.