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

How do you add "OR" Criteria to the SQL object in code

edited May 2002 in General
I am trying to manipulate the SQL object in code and am successful as long
as it is an "AND" operation. What I would like to do is have the SQL object
look something like this:


WHERE ( OR )
AND

So far I have been unable to find any example of how to accomplish this,
although I can see there is a way to ad an "OR" criteria and manipulate the
"level" the of a criteria. Is their any documentation for working with the
SQL object? Can this be accomplished using and AutoSearch?

Thanks in advance for the help.

Sincerely,

Eric Hansen

eric.hansen@protelinc.com

Comments

  • edited May 2002
    Yes, you can add an 'OR':

    Here is an example of modifying the TdaSQL object:
    http://www.digital-metaphors.com/tips/ExtractSQLObject.zip


    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);


    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.