Displays of Numeric Fields with more than 2 Decimals

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
ms_salinas
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 04.07.2007, 17:24
Location: Brownsville

Displays of Numeric Fields with more than 2 Decimals

Post by ms_salinas »

Hi,

I was searching for a solution to this problem, but I can't get it solved yet:

I have a field declared as NUMERIC(9,2). At the time to get a value of 12.12, it is displaying on the Grid a number with a lot of decimal digits like 12.1199998855591

I am using Delphi 7, Zeos 6.6.1 (Beta) and Firebird 1.53

Can somebody help me solving this problem ?

Thanks in advance.

Manuel.
gto
Zeos Dev Team
Zeos Dev Team
Posts: 278
Joined: 11.11.2005, 18:35
Location: Porto Alegre / Brasil

Post by gto »

Welcome ms_salinas!

This problem, at common sensus, is generated by delphi itselfs, while manipulating floating point values. I've never come deep into Zeos to clarify it, but it should be true.

Fortunately, there's a bypass. Doube click in the query component, select the field and type in the DisplayFormat propery: 0.00

EDIT: By the way, is has been discussed here: http://zeos.firmos.at/viewtopic.php?t=9 ... t=decimals
Use the FU!!!!!IN Google !

gto's Zeos Quick Start Guide

Te Amo Taís!
ms_salinas
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 04.07.2007, 17:24
Location: Brownsville

Displays of Numeric Fields with more than 2 Decimals

Post by ms_salinas »

Hi gto,

Regarding your suggestion to edit FiledsEditor... when I go there, the pop-up window is empty :?:.
I am using the TZQuery Component, the SQL contains a sentence like this: "Select * From Cargos where Folio = :Folio"

I found this code and it solved the problem:

//---------------------
var
xInd : integer;
xFld : TField;
begin
for xInd := 0 to DM.CARGOS.Fields.Count-1 do
begin
xFld := DM.CARGOS.Fields[xInd];
case xFld.DataType of ftFloat :
TFloatField(xFld).DisplayFormat := '#,##0.00';
end;
end;
end;
//---------------------

I never had this problem when I used the IBX Components.

Thanks for your help. :?: :?: :?:
gto
Zeos Dev Team
Zeos Dev Team
Posts: 278
Joined: 11.11.2005, 18:35
Location: Porto Alegre / Brasil

Post by gto »

Hum.. glad to see it solved.

The popup is empty because you need to add the fields to the query when you want them to be objects. With the SQL and Conenction property filled, double click in the query and at the blank popup right click then select add all fields.

Anyway, the code you posted do the same thing :)
Use the FU!!!!!IN Google !

gto's Zeos Quick Start Guide

Te Amo Taís!
Post Reply