Subject | FieldsDispalyformat problem - reposted |
---|---|
Author | Stuart Hunt |
Post date | 2004-03-23T15:27:09Z |
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
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