[fpc-pascal] Custom dataset help request: ftCurrency/ftDateTime returns weird data
Reinier Olislagers
reinierolislagers at gmail.com
Fri Oct 4 15:34:53 CEST 2013
Hi all,
I'm writing a custom dataset that represents a list of bank
transactions: [1]
When showing a currency field (the Amount field in the transaction
object in the code), I get NaN.
Likewise, I get invalid results from a date field (Bookdate in the
transaction object)
AFAIU, I can just store the data the way I want but obviously I'm
missing something.
The relevant code:
function TTransactionDataset.GetFieldData(Field: TField; Buffer:
Pointer): boolean;
...
Result := true;
case Field.FieldName of
'HashID': StrPLCopy(Buffer, FTransactionList[FCurrentRecord].HashID,
Field.Size);
'BookDate': TDateTime(Buffer^) :=
FTransactionList[FCurrentRecord].BookDate;
'Amount': Currency(Buffer^) := FTransactionList[FCurrentRecord].Amount;
FTransactionList is the list with the underlying objects. FCurrentRecord
is the current record number.
Suggestions welcome.
Thanks,
Reinier
[1] https://bitbucket.org/reiniero/smalltools/src
directory
BankConvert
file
transactiondataset.pas
More information about the fpc-pascal
mailing list