Focal Point
Field format in EXL2K

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

April 02, 2008, 10:10 AM
arsalan
Field format in EXL2K
There's a link on my WebFocus html page that creates an excel sheet (EXL2K). In one of the fields in excel, the total is displayed at the bottom by using: ON TABLE COLUMN-TOTAL AS 'TOTAL' UNITS
If I manually select all the values in that column and add them up it is slightly different than what is calculated by WF.

This field is declared as D12.2 in master file but all the values are displayed as integer in excel.
I believe this is because of the internal behavior of WF for EXL2K that rounds up to the nearest integer value and then dispaly it in excel.

Is there a way to retain their formatting i.e. to dispaly values in decimal in excel?

I tried converting D12.2 to D12 and both the totals came out to be the same but I want it the other way round i.e. in decimal.

Thanks.
April 02, 2008, 10:16 AM
Francis Mariani
A Dnn.n field should display as nn.n in HTM, PDF, EXL2K, it won't be transformed to an integer unless the program does that.

TABLE FILE CAR
SUM WHEELBASE
BY COUNTRY
ON TABLE SUBTOTAL
ON TABLE PCHOLD FORMAT EXL2K
END


or
TABLE FILE CAR
SUM WHEELBASE
BY COUNTRY
ON TABLE COLUMN-TOTAL AS 'TOTAL'
ON TABLE PCHOLD FORMAT EXL2K
END

WHEELBASE is defined as D6.1 and displays as such in Excel.


Francis


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
April 02, 2008, 02:14 PM
arsalan
Francis,

Let me correct my previous statement, actually the field is declared as D12 not D12.2
I'm not sure that it contains decimal values in datasource or not.
In the file I could not see any code that transforms the field.

But I get two different values of sums in excel, manually and by WF.

Any suggestions would help.
Thanks.
April 02, 2008, 02:37 PM
Francis Mariani
This sounds completely different than your original question.

It is quite possible that the data has decimal values, because, even though D12 does not have any decimal places showing, they are used for the internal calculations.

Hopefully this example illustrates this for you. P does not behave the same way as D.

DEFINE FILE CAR
M1A/D12.2 = 10.45;
M2A/D12.2 = 9.25;
M1B/D12 = M1A;
M2B/D12 = M2A;
M1C/P12 = M1A;
M2C/P12 = M2A;

M3A/D12.2 = M1A + M2A;
M3B/D12 = M1B + M2B;
M3C/P12 = M1C + M2C;
END
TABLE FILE CAR
SUM
M1A M2A M3A
M1B M2B M3B
M1C M2C M3C
BY COUNTRY
-*ON TABLE PCHOLD FORMAT EXL2K
END



Francis


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
April 02, 2008, 02:59 PM
arsalan
Thanks Francis,

That example did make many things clear to me.
Also, I found out, that field was created from two Dnn.n fields and rounding to the nearest integer value, that's why the two sums were different. If I print it as D12.2 field the sums come out to be same.
April 03, 2008, 04:51 PM
Waz
Have you tried
 ON TABLE PCHOLD FORMAT EXL2K FORMULA 
as this will let Excel to the totalling


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!