Page 1 of 1

Assign method ignores currency property value

Posted: Sun 31 Jul 2011 16:53
by delphiguy101
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!!

Posted: Sun 31 Jul 2011 17:15
by delphiguy101
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;

Posted: Tue 02 Aug 2011 06:05
by AndreyZ
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.