Hi All ,
i have a problem in excel report report output in
i have a 2 column and cal ROW-TOTAL
the ROW-TOTAL column is cal and decimal is showing as ".01000001" it should show as ".01"
COL1 COL2 TOT
-846.50 247.49 -599.01000001
Need help in resolving this
Thank youThis message has been edited. Last edited by: FP Mod Chuck,
First when posting sample code or result, please use the code tag.
It's the last icon on the ribbon :
Secondly, what is the COL1 & COL2 format ? That can make the whole difference.
Thirdly, are you 100% sure that COL1 & COL2 have the sample value you shown us ?
Fourth, always a good idea trying to reproduce with IB file such as CAR
Fifthly, always a good idea to share your code
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
the format column is "D20S"
Is D20S the ACTUAL or USAGE format? D20S as a USAGE format should only print the integer portion of the value. The one thing to keep in mind with F and D formats is that internally (memory and FOCUS file) they store every significant digit. So if COL1 is a computed field or a field in a FOCUS/XFOCUS file, -846.50 is really -846.50000001, which is why you are getting the result your are getting. Try the following:
DEFINE FILE CAR VAL1/D20S WITH COUNTRY=-846.50000001; END TABLE FILE CAR PRINT VAL1 VAL1/D20.8S COMPUTE VAL2=VAL1; COMPUTE VAL3/D20.2S=VAL1; COMPUTE VAL4/D20.8S=VAL1; COMPUTE VAL5/D20.8S=VAL2; IF COUNTRY EQ 'ENGLAND' END
In this example, you can see how VAL1 with a D20 format (no decimal) really stores all the significant digits and what is printed is based on the USAGE format. Notice VAL2. If a variable is given no format, the default field format is D and the default USAGE is D12.2. When doing computations with D fields, what is used in the internal value not the "USAGE" value.
In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
Conver the field to Packed Decimal instead of Decimal.
That will round the values and hold it.
I have just changed the format of Define Field from D to P
DEFINE FILE CAR VAL1/P20S WITH COUNTRY=-846.50000001; END TABLE FILE CAR PRINT VAL1 VAL1/D20.8S COMPUTE VAL2=VAL1; COMPUTE VAL3/D20.2S=VAL1; COMPUTE VAL4/D20.8S=VAL1; COMPUTE VAL5/D20.8S=VAL2; IF COUNTRY EQ 'ENGLAND' END
In Focus since 2006
|Powered by Social Strata|