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

Combining criterias with CreateAutoSearchCriteria ...

edited February 2004 in End User
Hello,

I need a way to filter the information that feeds a report, so I tried
adding criterias programatically using CreateAutoSearcCriteria, but I
found that every criteria I added was related with each other as a
logical "AND"

So, my question is how to add criteria logically related with other
logical operators like "OR" or "NOT"? Also, please advice me if this is
the correct solution for my requirements, because I read about setting
report parameters. Are Parameters the correct way to address this? and
if so, how? or is there a way to programatically change the SQL stored
in the report? Something like "SELECT * FROM COSTUMERS" and
programatically change it to "SELECT * FROM CUSTOMERS WHERE LOCATION =
CANADA"

Thanks a lot in advance
Luis Ximénez

Comments

  • edited February 2004
    -------------------------------------------------
    Tech Tip: How to add OR criteria in code
    -------------------------------------------------

    The 'And' operator is implied. To add an Or, Begin, End to the criteria
    you need to extract the TdaSQL object and then use
    TdaSQL.InsertCriteria. Below is the function declaration.

    function InsertCriteria(aPosition: Integer; aType: TdaCriteriaType):
    TdaCriteria;


    TdaCriteriaType is defined in TdaSQL.pas as

    TdaCriteriaType = (dacrField, dacrOR, dacrNOT, dacrBegin, dacrEnd);


    A call would look like

    lSQL.InsertCriteria(0, dacrOR);


    --
    Tech Support mailto:support@digital-metaphors.com
    Digital Metaphors http://www.digital-metaphors.com

    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited February 2004

    Note: The built-in AutoSearch does not display the OR, therefore if you need
    that functionality you will need to customize it - see
    RBuilder\Demos\AutoSearch\Custom AutoSearch Dialog.


    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

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