Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Placing a Datetime on a report when it contains a TTimestamp value

edited August 2004 in General
When I try to place a Datetime field from by database on a report in
designer I get an "integer overflow" error.

I think the problem is caused by my ADO components that query the database,
in certain situations rather than return a TDateTime value I get a
TTimestamp (something e6 bigger than the equivalent TDatetime).
Unfortunately I have lost the source code for these components (DiamondADO),
and the author is not responding to email. I am in a bind! Meanwhile my
project deadline is tight, I don't have time to change from D5, get new ADO
components etc.

Is there some way I can work with the TTimestamp values that the query is
returning, and get them displayed as a datetime on a report? The dynamically
created Tfield has type=ftDatetime, so RB tries to treat it as a TdateTime
value and raises an exception. Is there some way to stop this, and force
some data conversion first.

I am hoping someone can suggest a quick workaround.

Dave Blake

Comments

  • edited August 2004
    Hi Dave,

    Instead of using a DBText to get the TimeStamp data, try using a TppVariable
    and retrieve the data manually. Simply place a TppVariable on your report
    and in its OnCalc event get the timestamp value, convert it to a TDateTime,
    and finally set it to the value of the variable. Something like the
    following.

    procedure TForm1.ppVariable1Calc(Sender: TObject; var Value: Variant);
    begin

    Value := TimeStampToDateTime(Table1['TimeStampField']);
    end;

    Be sure you set the type of the TppVariable to DateTime.
    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.