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

Condition when changing the SQL Text before print a report

edited March 2004 in End User
What?s the trick to do that, speaking about parentheses:

( (Condition1 = 10) OR (Condition2 = 20) ) AND others conditions

No problem until the most internal parentheses... the most external
before the 'AND' clausule i would like to know how to put them!

thanks in advance.


Marcelo

Comments

  • edited March 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 Corporation
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited March 2004
    could you give me a example base on this: ( (Condition1 = 10) OR
    (Condition2 = 20) ) AND others conditions
    ?

    thanks

  • edited March 2004

    1. To insert the '(' and ')' using the Query Designer, access the Search
    tab. In the bottom listview that displays the criteria fields, select the
    row at which you would like to insert the ( or ). Press the right mouse
    button and a popup menu will appear. Select Begin to insert '(' and select
    End to insert ')' Use the up/down arrows to reposition the begin,end.

    2. To do this programmatically

    You need to extract the TdaSQLObject for the report and determine tghe
    position in the TdaSQL.Criteria[] array where you want to insert the '(' and
    ')' then for each call

    lSQL.InsertCriteria(liBeginPosition, dacrBegin);

    lSQL.InsertCriteria(liEndPosition, dacrEnd);

    The following example shows how to extract the TdaSQL object.

    http://www.digital-metaphors.com/tips/ExtractSQLObject.zip


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

    Best regards,

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