# Board index » delphi » AddFieldDef - (currency) Decimal point problem

## AddFieldDef - (currency) Decimal point problem

Hi
Building  a table in runtime and filling it with data,  the currencyfield gives
a problem with decimal numbers.

Part of the code:

with FieldDefs do begin
Clear;

// Problem field!
Name := 'price';
DataType :=ftcurrency;   // or ftfloat
// size:=6;      size and dec   these are not accepted bij the compiler
// dec:=2;
end;
Because Size and Dec are not to be used  only whole numbers are accepted by the
field,
(The sourcefile datafield is a ftfloat field)
How do I get a Decimal point in this field??

Frits v/d Laan
NL

## Re:AddFieldDef - (currency) Decimal point problem

1. You can only use the Precision and Size properties for BCD fields, not
for Currency fields.
2. Currency fields behave just like Float fields (except that they have a
fixed precision of 4 and don't use an exponent).
3. You can influence the way Delphi displays (and parses) currency values by
changing the CurrencyString, CurrencyFormat, NegCurrFormat,
ThousandSeparator, DecimalSeparator and CurrencyDecimals variables from the
SysUtils unit.
4. You can influence the way the BDE displays currency values by changing
the DECIMALSEPARATOR, THOUSANDSEPARATOR, DECIMALDIGITS and LEADINGZERON

"Frits v/d Laan" <f.vd.l...@inter.nl.net> wrote in message
news:3b7843dd.4418919@news.inter.nl.net...

##### Quote
> Hi
> Building  a table in runtime and filling it with data,  the currencyfield
gives
> a problem with decimal numbers.

> Part of the code:

> with FieldDefs do begin
>       Clear;

> // Problem field!
>         Name := 'price';
>         DataType :=ftcurrency;   // or ftfloat
> // size:=6;      size and dec   these are not accepted bij the compiler
> // dec:=2;
>         end;
> Because Size and Dec are not to be used  only whole numbers are accepted
by the
> field,
> (The sourcefile datafield is a ftfloat field)
> How do I get a Decimal point in this field??

> Frits v/d Laan
> NL

## Re:AddFieldDef - (currency) Decimal point problem

Thanks for this and like to say I learn a lot from your activity  on the
newsgroups

On Tue, 14 Aug 2001 08:40:36 +0200, "M.H. Avegaart" <avega...@NOSPAMmccomm.nl>
wrote:

##### Quote
>1. You can only use the Precision and Size properties for BCD fields, not
>for Currency fields.
>2. Currency fields behave just like Float fields (except that they have a
>fixed precision of 4 and don't use an exponent).
>3. You can influence the way Delphi displays (and parses) currency values by
>changing the CurrencyString, CurrencyFormat, NegCurrFormat,
>ThousandSeparator, DecimalSeparator and CurrencyDecimals variables from the
>SysUtils unit.
>4. You can influence the way the BDE displays currency values by changing
>the DECIMALSEPARATOR, THOUSANDSEPARATOR, DECIMALDIGITS and LEADINGZERON

>> with FieldDefs do begin
>>       Clear;

>> // Problem field!