Subject Solution: Problem in TIB_Query and currency...
Author jocelyndionne@uraeus.qc.ca
Hello Jason.

I found something interesting.

I said in a previous post that the IsCurrency variable (or property)
was not set to True even if I specify 'Currency' in the column
attributes. I was right for a 'double precision' field but I was
wrong for a 'Numeric(x,y)' field.

So, this means that the FloatToStrF is called for the Numeric(x,y)
fields.

Why does this return something strange instead of a currency? If I
look in the help, it says that the third parm is the precision. You
use SQLScale. I think it's the problem. The help says that for an
extended variable, we can use 18 or less. So I changed the third
parameter to 18, given the fact that you use AsExtended in the first
parameter. And it works...

If the field was defined Numeric(11,4), the value of the third
parameter was 4 (the SqlScale), obviously not enough precision,
result: a strange return value.

So my change is:

Result := FloatToStrF( AsExtended,
ffCurrency,
18 {-SQLScale},
CurrencyDecimals )


Alas, I did not find why the IsCurrency is not set to true for
the 'Double precision' fields. I think I will leave it to you. I
don't need 'Double precision' for my 'Currency' fields. I was using
them because I was thinking it was a precision problem. So, I
changed my fields back to Numeric(x,y) and everything is Ok.


Look at this and see if something better can be done.


Thanks for the help.
(I won't sleep long enough once again):-(


Jocelyn Dionne.




--- In IBObjects@y..., jocelyndionne@u... wrote:
> When I posted the first message about this problem, I was sure that
> it was a known problem with a fast solution.
>
> Now that I know it's not, I will go further in the code and try to
> find where it fails. I will let you know as soon as I succeed...
or
> not. :-)
>
> Jason, if this can help, I said in a previous post that in the
> GetDisplayText function in TIB_Column, the IsCurrency variable is
not
> set to true even if I specify 'currency' in column attributes. So,
> it cannot execute the code to format to currency.
>
> ---
> else
> if IsCurrency then
> Result := FloatToStrF( AsExtended,
> ffCurrency,
> -SQLScale,
> CurrencyDecimals )
> ---
>
>
> Obviously, the problem happens before this, it should be set to
true.
>
> I hope this will help.
>
>
> Jocelyn Dionne.
>
>
>
> --- In IBObjects@y..., jocelyndionne@u... wrote:
> > Hi Jason.
> >
> > I don't have any DisplayFormat, if you're talking about the
> > possibility to enter a format in the field properties tab.
> >
> > You will understand that I don't want to use a specific format,
but
> > prefer to use the regional settings preferences.
> >
> > But if I don't specify 'currency' in the column attributes tab,
and
> > use a display format, it works very well.
> >
> > Thanks.
> >
> >
> > Jocelyn Dionne.
> >
> >
> >
> >
> > --- In IBObjects@y..., "Jason Wharton" <jwharton@i...> wrote:
> > > I think this is an issue of presentation instead of actual
> accuracy
> > of what
> > > is being stored. Do you have a DisplayFormat setting of some
kind?
> > >
> > > Jason Wharton
> > > CPS - Mesa AZ
> > > http://www.ibobjects.com