Subject | Re: [IBO] How to Format a FLOAT field? |
---|---|
Author | Helen Borrie |
Post date | 2005-02-25T01:15:11Z |
At 06:39 PM 24/02/2005 +0000, you wrote:
included in FieldEntryTypes) or fully-qualified column identifier (with
fetSQLType included). In code, the FieldEntryTypes property should be set
*first*, before your code tries to access FieldsDisplayFormat. The format
string has to be a valid Delphi format string.
It is much easier to set these properties at design time. For example,
set FieldEntryTypes to [fetSQLType,fetDomainName]
and set FieldsDisplayFormat to
d_currency='0.00'
or
Invoice.Total='0.00'
The simplest thing to do is just to set the CURRENCY property of the domain
or column to True. You only need a format string if you want to include
extra things (like a currency symbol, for example).
-- With an IB_Query, do this in the Fields Editor (Column Attributes)
-- With any IB_Dataset or IBODataset, you can set it in the
ColumnAttributes property (a stringlist) or in code
-- If you have a domain for your currency fields, you can set this property
for all fields in the database, by including fetDomainName in the
FieldEntryTypes set of your connection object. If you want to set it
globally at field level, then also include fetSQLType.
At connection level, open the editor for ColumnAttributes. To specify the
Currency attribute for a domain named D_Money, do this:
D_Money=CURRENCY=T
To specify it globally at field level, e.g. for a table named Invoice with
a column named Total:
Invoice.Total=CURRENCY=T
To specify it at dataset level (for ib_cursor and ibodatasets), open the
ColumnAttributes editor and enter
Total=CURRENCY=T
There is a TI Sheet on all of this: Working with Fields and Params
(download from the Tech Info page of the IBO website). If you have the
Getting Started Guide, there is an Appendix on the topic.
If you are using the TIBODatasets ("TDataset-compatible") you also have the
option of instantiating a TField and making it a TIBOBCDField.
Helen
>Hi All!At connection level, you have to specify either domain (with fetDomainName
>
>I want to format a float field with 2 decimals, ex.: 12.2156523123,
>converted = 12.21. I tried to use
>IB_Connection.FieldsDisplayFormat := 'TEST=0.00' and
>IB_Connection.FieldEntryTypes = fetDomainName, but it gives me this
>error: "EConvertError with message "xxxx" is not a valid integer
>value".
included in FieldEntryTypes) or fully-qualified column identifier (with
fetSQLType included). In code, the FieldEntryTypes property should be set
*first*, before your code tries to access FieldsDisplayFormat. The format
string has to be a valid Delphi format string.
It is much easier to set these properties at design time. For example,
set FieldEntryTypes to [fetSQLType,fetDomainName]
and set FieldsDisplayFormat to
d_currency='0.00'
or
Invoice.Total='0.00'
The simplest thing to do is just to set the CURRENCY property of the domain
or column to True. You only need a format string if you want to include
extra things (like a currency symbol, for example).
-- With an IB_Query, do this in the Fields Editor (Column Attributes)
-- With any IB_Dataset or IBODataset, you can set it in the
ColumnAttributes property (a stringlist) or in code
-- If you have a domain for your currency fields, you can set this property
for all fields in the database, by including fetDomainName in the
FieldEntryTypes set of your connection object. If you want to set it
globally at field level, then also include fetSQLType.
At connection level, open the editor for ColumnAttributes. To specify the
Currency attribute for a domain named D_Money, do this:
D_Money=CURRENCY=T
To specify it globally at field level, e.g. for a table named Invoice with
a column named Total:
Invoice.Total=CURRENCY=T
To specify it at dataset level (for ib_cursor and ibodatasets), open the
ColumnAttributes editor and enter
Total=CURRENCY=T
There is a TI Sheet on all of this: Working with Fields and Params
(download from the Tech Info page of the IBO website). If you have the
Getting Started Guide, there is an Appendix on the topic.
If you are using the TIBODatasets ("TDataset-compatible") you also have the
option of instantiating a TField and making it a TIBOBCDField.
Helen