views:

36

answers:

1

Hello

I have an accuracy problem with a reporting tool that I'm using. The issue is that it is reading in data from a TADODataset on the fly but converting the ftBCD fields into doubles.

This causes rounding errors when performing operations at the reporting level (sums, etc).

I'd like to specify my currency fields as ftCurrency, not ftBCD to stop this from hapening.

If I create a field as:

TFieldDef.Create( ADODataset.FieldDefs,
    'test',
    ftCurrency,
    0,
    True,
    0
  );   

ADODataset.CreateDataSet;

Using the watch, I can now see that ADODataset.Fields[0].DataType has a value of ftBCD.

Is there a way to explicitly specify a ftCurrency field within a TADODataset so it's not assigned as a ftBCD field?

A: 

try this

ADODataSet.FieldByName('AField').Currency := True;

best regards,

Radu Barbu
Thanks. Although you need to typecast is as:TCurrencyField(ADODataSet.Fielddefs[i]).Currency := True;
Mattl
While this sets the field in the dataset to be a currency it is still not passing though to the reporting engine pipeline. I'll have to investigate further.
Mattl
i forgot about that, i'm a little bit on hurry. glad that worked. best regards,
Radu Barbu