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

filtering data for a report

edited April 2007 in General
I'm using Delphi 7 and RB 9.02.

I have created a report which returns all the users from a table (I have
used the Data settings under the data tab of the report builder dialog). At
run time I need to allow the user to just return the users that fit a
criteria, EG Surname = Smith etc. In crystal I could pass in a formula to do
this:
(not IsNull({cards.Surname})) AND ( (LowerCase({Cards.Surname}) =
LowerCase('Smith')))

Is there a similar system for Report Builder or do I have to create a full
SQL statement ?

Ian Munro

Comments

  • edited April 2007
    Ian,

    There are numerous ways to filter your data from within the report.
    Similarly to what you have below, you can use the DetailBand.BeforePrint
    event to compare the current record value to something.

    Take a look at the AutoSearch demos located in the
    \RBuilder\Demos\AutoSearch\... directory. This will give you a good idea
    how you can add search conditions to your data while previewing the report.

    I strongly suggest spending some time with the demos provided and the
    Developer's Guide provided with ReportBuilder. This will give you a good
    idea how to accomplish the basic reporting tasks required to easily create
    reports with ReportBuilder.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2007
    The "TdaSQLBuilder SearchCriteria" seems to do what I need. Unfortunately
    I'm updating our reporting program so I need to use a lot of the existing
    design (it did use Crystal 8). This SearchCriteria fits in with the current
    code. I can use a statement like this:

    lSQLBuilder.SearchCriteria.Add ('Cards', 'Surname', '=', 'Smith');

    but what do I need to do if I want to "OR" two statements ? Lets say that I
    want to run a report where the surname is "Smith" or "Brown". Should I use
    the "InsertOr" command ?

    I will check out the Demo section. Thanks for you help.

    Ian

  • edited April 2007
    Using the lSQLBuilder class, is there any way to make the queries
    case-insensitive ?
    At the moment if I pass in "smith" rather than "Smith" the query will fail.


  • edited May 2007
    You will want to use the InsertOr statement to add an "OR" to your SQL
    statement.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2007
    Hi Ian,

    The SQLBuilder does not have any built-in feature to remove case sensitivity
    your database enforces. It is simply used to manually construct the
    underlying SQL of dataviews in DADE. You could possibly manually check to
    see if a record is returned before creating the search criteria or perhaps
    there is a setting in your database to remove this restriction.

    --
    Regards,

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

    Best Regards,

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