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

Expression Field Type

edited May 2007 in End User
Hello I am creating a calc field based on a dateTime field. I am calculating
the average time spent which will return a field type int. I place this calc
field on my report and then run it and an error is shown saying

"Cannot access field 'avg_datediff_hh_Call_Actu' as type DateTime"

I am using RB 9.03

Is there a way for RB to correctly determine the data type returned from the
expression instead of basing it on the initial field that is added.

thanks in advance

tom

Comments

  • edited May 2007
    Hi Tom,

    ReportBuilder gets the field datatype directly from the database you are
    accessing. Are you calculating the average time spent in SQL code? If so,
    you will need to cast that field as an int or else the datatype will remain
    a DateTime.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2007
    Nico,
    Maybe I was not clear in my Post.

    1) I goto a report and hit the data Tab.
    2) I hit the "Calcs" button
    3) I select a field which is of type DateTime
    4) I then change the Function column to type expression
    5) I change the expression column to avg(datediff(hh, Date_Field1,
    Date_Field2)). This will return an Int.
    6) I goto my report by hitting the Design tab.
    7) I place a new data field on my report and link it to the above calc
    field. This will cause the error below.

    Is there any way of accessing this calc field?

    cheers

    tom




  • edited May 2007
    Hi Tom,

    Sorry for the delay, for some reason my newsreader was not picking this
    thread up.

    What database and connectivity are you using? In my testing with a similar
    setup to the one you describe below with SQL Server and ADO, I did not
    receive an error.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2007
    yes. seems it is in my custom connectivity stuff.

    Thanks Nico

This discussion has been closed.