Subject | How to Format a FLOAT field? |
---|---|
Author | marcoandrecarvalho |
Post date | 2005-02-24T18:39:56Z |
Hi All!
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".
I also tried to use CalculateFields, but without success either:
IB_Query1.CalculatedFields := 'TEST FLOAT NOT NULL' with the
following event:
procedure TDataModule1.taTestCalculateField(Sender: TIB_Statement;
ARow: TIB_Row; AField: TIB_Column);
begin
if AField.FieldName = 'GANHO' then
AField.AsString := FormatFloat('##0.00',ARow.ByName
('TEST').AsFloat);
end;
Can anyone give me a tip? What i´m doing wrong?
[]s, Marco André
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".
I also tried to use CalculateFields, but without success either:
IB_Query1.CalculatedFields := 'TEST FLOAT NOT NULL' with the
following event:
procedure TDataModule1.taTestCalculateField(Sender: TIB_Statement;
ARow: TIB_Row; AField: TIB_Column);
begin
if AField.FieldName = 'GANHO' then
AField.AsString := FormatFloat('##0.00',ARow.ByName
('TEST').AsFloat);
end;
Can anyone give me a tip? What i´m doing wrong?
[]s, Marco André