Subject Re: [IBO] How to Format a FLOAT field?
Author marcoandrecarvalho
--- In IBObjects@yahoogroups.com, "Paulo Carvalho"
<paulo.sergio@e...> wrote:
> Hi Marco,

Hi Paulo!

>
> Do already try use the FireBird function "round"?

No.

> This function have two parameters:
> 1º - the Field (a double value)
> 2º - number of precision
>
> Ex: select round(num,2) from tableX where ...
>
> if the "num" is 12.2156523123 this select retrive 12.21
>
> Regards,

It will work for editing intention, i mean, i want to be able to edit
the result, change values in a grid for example?

I resolved the problem changing the data type of the column to
Numeric.

Thank you very much, Paulo!

>
> [Português]
> Oi Marcos,
>
> Você já tentou usar a função "round" do FireBird?

Não.

> Esta função recebe dois parâmetros:
> 1º - o campo que você deseja selecionar (valor real)
> 2º - o numero de casas decimais que você deseja
>
> Ex: select round(num,2) from tabelaX where ...
>
> Se num valer 12.2156523123 o valor retornado pelo select será:
12.21
>
> Blz?!

Blz!

Isso vai funcionar com o propósito de edição de resultados? Digo, eu
quero ser capaz de editar os valores em um grid por exemplo.

Solucionei o problema convertendo o tipo de dado dessa coluna por
Numeric.

Muito obrigado Paulo!

[]s, Marco André

>
> Paulo Sérgio Carvalho
> Tecnologia de Informação
>
> Engeman EAM Ltda
> paulo@e...
> http://www.engeman.com.br
> ++ 55 (037) 3241 - 1084
>
> ----- Original Message -----
> From: marcoandrecarvalho
> To: IBObjects@yahoogroups.com
> Sent: Thursday, February 24, 2005 3:39 PM
> Subject: [IBO] How to Format a FLOAT field?
>
>
>
> 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é
>
>
>
>
>
>
______________________________________________________________________
_____
> IB Objects - direct, complete, custom connectivity to Firebird or
InterBase
> without the need for BDE, ODBC or any other layer.
>
______________________________________________________________________
_____
> http://www.ibobjects.com - your IBO community resource for Tech
Info papers,
> keyword-searchable FAQ, community code contributions and
more !
>
>
> Yahoo! Groups Sponsor
> ADVERTISEMENT
>
>
>
>
>
> --------------------------------------------------------------------
----------
> Yahoo! Groups Links
>
> a.. To visit your group on the web, go to:
> http://groups.yahoo.com/group/IBObjects/
>
> b.. To unsubscribe from this group, send an email to:
> IBObjects-unsubscribe@yahoogroups.com
>
> c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.
>
>
>
> [Non-text portions of this message have been removed]