Subject | Re: [IBO] FieldsDispalyformat problem - reposted |
---|---|
Author | Arn |
Post date | 2004-03-23T18:25:36Z |
Hi Stuard.
Geraldo Lopes de Souza has helped Me to solve it.
His mail seems don't work.
HTH
Ciao
Arnaldo
// *******************
// begin Geraldo mail
This bug is corrected in IBO 4.3Ab_test.
It has to do with TIB_Collumn.GetAsExtended in IB_Components.
The old one was:
var
tmpS: string;
begin
tmpS := AsString;
if tmpS = '' then
Result := 0
else
if SQLScale = 0 then
Result := StrToInt( tmpS )
else
Result := StrToFloat( tmpS );
end;
The new one is:
var
tmpS: string;
begin
tmpS := AsString;
if tmpS = '' then
Result := 0
else
case SQLType of
SQL_FLOAT,
SQL_FLOAT_: Result := AsFloat;
SQL_DOUBLE,
SQL_DOUBLE_: Result := AsDouble;
else
if SQLScale = 0 then
Result := StrToInt( tmpS )
else
Result := StrToFloat( tmpS );
end;
end;
Use the new version os copy and paste the code from the new version.
Hope this helps.
The correction was not made by me. I just encountered the bug and
figured out that the new last version already solves it.
Geraldo Lopes de Souza
// end Geraldo mail
// *******************************************************
Geraldo Lopes de Souza has helped Me to solve it.
His mail seems don't work.
HTH
Ciao
Arnaldo
// *******************
// begin Geraldo mail
This bug is corrected in IBO 4.3Ab_test.
It has to do with TIB_Collumn.GetAsExtended in IB_Components.
The old one was:
var
tmpS: string;
begin
tmpS := AsString;
if tmpS = '' then
Result := 0
else
if SQLScale = 0 then
Result := StrToInt( tmpS )
else
Result := StrToFloat( tmpS );
end;
The new one is:
var
tmpS: string;
begin
tmpS := AsString;
if tmpS = '' then
Result := 0
else
case SQLType of
SQL_FLOAT,
SQL_FLOAT_: Result := AsFloat;
SQL_DOUBLE,
SQL_DOUBLE_: Result := AsDouble;
else
if SQLScale = 0 then
Result := StrToInt( tmpS )
else
Result := StrToFloat( tmpS );
end;
end;
Use the new version os copy and paste the code from the new version.
Hope this helps.
The correction was not made by me. I just encountered the bug and
figured out that the new last version already solves it.
Geraldo Lopes de Souza
// end Geraldo mail
// *******************************************************
> All,___________________________________________________________________________
> I posted this problem last week but have had no response. This is a
> big problem for us as we use fixed floating point numbers a lot in
> our application. Does anyone have any ideas please?
>
>
> I'm using IBO 4.3Aa, Delphi 7 and IB 7 (1.1.0.19).
> If I have a float field in a table which I attach to a grid
> everything is OK, except sometimes you get the rounding problem -
> i.e. 1.1 is shown as 1.09999967. to get around this I put the
> format specifier ##0.00 into the the FieldsDisplayFormat property of
> the TIB_Query component, but as soon as I do this and activate the
> query I get a '1.09999967 is not a valid integer' error.
> This worked fine in IBO 3.x. So, does anyone know of a way around
> this, or am I doing something wrong? If it is a bug is there a fix
> available please?
> TIA,
> Stuart Hunt,
> Technical Team Leader,
> IdeaGen Software PLC
>
> To reproduce, create a DB as follows:
>
> SET SQL DIALECT 3;
> CREATE DATABASE '<database>' PAGE_SIZE 4096
> DEFAULT CHARACTER SET WIN1252;
>
> CREATE DOMAIN "FLOATFLD" AS FLOAT;
> CREATE DOMAIN "PRIMARYKEYFLD" AS INTEGER NOT NULL;
>
> /* Table: IBOTEST, Owner: SYSDBA */
>
> CREATE TABLE "IBOTEST"
> (
> "ID" "PRIMARYKEYFLD",
> "REVISION" "FLOATFLD"
> );
>
> then insert the following row:
>
> insert into IBOTEST (ID, REVISION) values (1, 1.09999967);
> commit;
>
> next create a simply form and attach it to the DB. The DFM info for
> this form is (non-relevant form properties removed):
>
> object Form1: TForm1
> object IB_Grid1: TIB_Grid
> CustomGlyphsSupplied = []
> DataSource = IB_DataSource1
> TabOrder = 0
> end
> object ibcDB: TIB_Connection
> SQLDialect = 3
> Params.Strings = (
> 'SERVER=xxxx'
> 'PATH=c:\temp\test.gdb'
> 'PROTOCOL=TCP/IP'
> 'USER NAME=SYSDBA')
> end
> object ibtDB: TIB_Transaction
> IB_Connection = ibcDB
> Isolation = tiConcurrency
> end
> object ibqLookup: TIB_Query
> DatabaseName = xxxx:c:\temp\test.gdb'
> FieldsDisplayFormat.Strings = (
> 'REVISION=##0.00')
> FieldsDisplayWidth.Strings = (
> 'REVISION=161')
> IB_Connection = ibcDB
> IB_Transaction = ibtDB
> SQL.Strings = (
> 'select * from ibotest')
> ColorScheme = False
> KeyLinksAutoDefine = False
> KeySeeking = False
> MasterSearchFlags = [msfOpenMasterOnOpen,
> msfSearchAppliesToMasterOnly]
> BufferSynchroFlags = []
> FetchWholeRows = True
> end
> object IB_DataSource1: TIB_DataSource
> Dataset = ibqLookup
> end
> end
>
>
>
>
>
>
> IB Objects - direct, complete, custom connectivity to Firebird orInterBase
> without the need for BDE, ODBC or any other layer.___________________________________________________________________________
>
> http://www.ibobjects.com - your IBO community resource for Tech Infopapers,
> keyword-searchable FAQ, community code contributions and more !
> Yahoo! Groups Links
>
>
>
>
>
>