Assign method ignores currency property value

Discussion of open issues, suggestions and bugs regarding Virtual Data Access Components for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
delphiguy101
Posts: 5
Joined: Wed 10 Jun 2009 21:28

Assign method ignores currency property value

Post by delphiguy101 » Sun 31 Jul 2011 16:53

I tried assigning a TIBCQuery to a TVirtualTable using the Assign method and it successfully copied all of the fields and values. However, it does not copy the "currency" property for TFloatFields. As a result, money values are displayed on my data-aware components as just regular floats without currency symbols or proper formatting.

Is there a way to somehow get the currency property values copied to the TVirtualTable?

Thanks in advance!!

delphiguy101
Posts: 5
Joined: Wed 10 Jun 2009 21:28

Post by delphiguy101 » Sun 31 Jul 2011 17:15

Here is a procedure I just created which I will call after calling TVirtualTable.assign. This seems to work but perhaps there is a better solution?

Code: Select all

procedure CopyCurrencyFieldSettings(SrcDataset, DestDataset: TDataset);
var
  srcField : TField;
begin
  for srcField in SrcDataset.Fields do
  begin
    if (srcField is TFloatField) and
       (srcField as TFloatField).currency then
      (DestDataset.FieldByName(srcField.FieldName) as TFloatField).currency := true;
  end;
end;

AndreyZ

Post by AndreyZ » Tue 02 Aug 2011 06:05

Hello,

For the time being you should copy the currency property value on your own. We will investigate the possibility of adding such functionality to the TVirtualTable.Assign method.

Post Reply