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

Filling SearchExpression (Between) with Date RB 12

edited August 2011 in DADE
Hi,
We have just upgraded to RB 12 from RB10, and one thing we used to do
doesn't work anymore with the date pickers.
We use the report builder within our application, when the user select a
specific record in de DB before opening a report we
initialize the autosearchfields with the selected data in this way:

ppReport.AutoSearchFields[searchLoop].SearchExpression :=
fieldValue;

Where fieldValue is something like '01-01-2011,31-12-2011'

This doesn't work anymore with date fields, we get the melding "cannot
convert string to double" when the date picker is created...

What is the right way to init date search expressions when using BETWEEN or
NOT BETWEEN ?


(A normal search value "=" date still works).

Thanks
Chantal Marchand
People Inc

Comments

  • edited August 2011
    Hi Chantal,

    Which exact version of ReportBuilder and Delphi are you using? Also,
    which database are you currently using?

    In my testing with RB 12.05 and a simple example using the DBDEMOS
    database I was able to manually assign two dates to a BETWEEN autosearch
    expression and run the report successfully.

    As a test, try manually entering in a hard-coded pair of dates and see
    if you still get the same issue.

    ppReport.AutoSearchFields[0].SearchExpression := '01-01-2011,31-12-2011';
    ppReport1.Print;

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2011
    We use RB 12.04 with SQL db, I think I found out what our problem is.
    I tried entering the dates manually in the onbeforeautosearch, it
    worked...so I guess it was a problem with the data...

    In version 10 the searchexpression was altijd creating string values, also
    for dates, so giving 1 date instead of 2 wasn't a problem with BETWEEN, only
    the first value of the between would be filled in and the use could just
    fill in the second one, now it's not possible anymore because "empty string"
    can't be translated into a date...

    I had a few empty records in the database and '01-01-2011,' was causing the
    problem. I made sure that this can't happen anymore and it works.

    Thanks
    Chantal

This discussion has been closed.