How would I yank the last digit from a 3 decimal places to two without rounding the 2 decimal place?This message has been edited. Last edited by: FP Mod Chuck,
WebFOCUS 8105 Windows, Excel
November 06, 2017, 05:34 PM
Waz
Stick the number into a packed decimal field.
DEFINE/COMPUTE NEWFIELD/P20.2 = MY20D3FIELD ;
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
November 07, 2017, 04:19 AM
Tulsi
You can use define or compute for changing the format else simple put format with / for example
TABLE FILE CAR SUM SALES/D20.2 BY MODEL END
FORMAT D20.2 will restrict yr decimal filed value upto 2 decimal place.
webfcous 8202m windows 7
November 07, 2017, 08:17 AM
PO
Hello,
It is still rounding the next digit.
Here is what I need: 1.999 will be 1.99 I hope this help some.
WebFOCUS 8105 Windows, Excel
November 07, 2017, 09:33 AM
Kofi
You can be trying the one method of use INT. This not be nice but work!
TABLE FILE CAR
SUM COMPUTE VALUE/D12.3 = IF LAST VALUE EQ 0 THEN 1.99 ELSE LAST VALUE + 0.001;
-* This is be line important for you
COMPUTE BASE/P7.2 = INT(VALUE * 100) / 100;
BY CAR
ON TABLE SET PAGE NOLEAD
END
Kofi
Client Server 8.1.05: Apache; Tomcat;Windows Server 2012 Reporting Server 8.1.05; Oracle; MS SQL; Windows Server 2012
November 07, 2017, 09:36 AM
Kofi
Forgot, no use double precision as is retains all decimals - no good for you and this. Need packed decimal like Waz say as no retain decimals after using INT.
Kofi
Client Server 8.1.05: Apache; Tomcat;Windows Server 2012 Reporting Server 8.1.05; Oracle; MS SQL; Windows Server 2012
November 07, 2017, 03:16 PM
Waz
quote:
It is still rounding the next digit.
Ho PO,
What code did you use ?
The P format should work for you
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
December 08, 2017, 04:48 PM
TexasStingray
Multiple it by 1000 then convert it to an alpha with the edit function, then replace the last character with a 0, then convert is back to a decimal and then device by 1000.