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

RB 12.05 Null date values

edited September 2011 in General
Hi

I upgraded to RB 12.05 from 12.01 (Delphi 2007 U3).
I have a custom pipeline derived from TppJITPipeline to handle 1 row Jit
data (I have been using since RB7).

After I upgraded I have problems with null date values. I create a field
with type dtDateTime, and pass values thru OnGetFieldValue function
(with return type variant). When the date value is null I get a "cannot
convert variant type string to double". This was working in prior
releases (inc 12.01 and before)

Any ideas?

Bora Aydemir

Comments

  • edited September 2011

    I checked the version history and the JITPipeline has not been modified to
    handle GetFieldValue differently. You might try adding RBuilder\Source to
    the Delphi library path, then run under the debugger and when the exception
    occurs examine the call stack.


    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited September 2011
    I figured out the problem. I was sending a blank string to a datetime
    field when the value is null. What would be the best way to send null
    date values from Jitpipeline?


    Bora

    20/09/2011 18:26, Nard Moseley (Digital Metaphors) yazmis:
  • edited September 2011
    In Delphi VCL, TDateTime is a double, so you could return 0 or you could
    return Null.


    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited September 2011
    I get a 31/12/1899 when I send 0. It works when I dont assign anything
    to the result of the function, thus leaving the value unassigned. This
    works with datetime fields but will this approach cause problems?

    21/09/2011 19:16, Nard Moseley (Digital Metaphors) yazmis:
  • edited September 2011
    > I get a 31/12/1899 when I send 0.

    Correct, this is how TDateTime works - please see the Delphi help topic for
    TDateTime. It is worth reading to understand the details. :)


    If you don't return a value, then the value will be Null (see
    TppJITPipeline.GetFieldValue method in ppDBJIT.pas). If that works, then
    move forward and do further testing. I don't think that will cause an issue
    with controls like DBText, DBCalc. Any code you write to read and process
    the field value will have to check whether the value is null.


    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.