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

How do I set this in code for auto search

edited September 2002 in RAP
Hello,

In report builder query designer on the search tab I can set up parentheses
and OR in the criteria, but how would I do that in code. I have no problem
passing the the field ones but what about the other criteria like Begin,
End, OR?
for example
Begin (how do I code this line in?)
frmReportBuilder.ppReport.CreateAutoSearchCriteria
('plSEB','ConStartDate',soGreaterThanOrEqualTo,'',False);

frmReportBuilder.ppReport.CreateAutoSearchCriteria('plSEB','ConEndDate',soLe
ssThanOrEqualTo,'',False);
End
OR
Begin
frmReportBuilder.ppReport.CreateAutoSearchCriteria
('plSEB','ConStartDate',soGreaterThanOrEqualTo,'',False);

frmReportBuilder.ppReport.CreateAutoSearchCriteria('plSEB','ConStartDate',so
LessThanOrEqualTo,'',False);
End

Thanks,
Ian

Comments

  • edited September 2002
    You need to extract the TdaSQL object and insert them. A link to an example
    is below. Let's assume we've extracted the SQL object and have set the
    criteria values. Now we can insert the parentheses and OR.

    {set order no. search value}
    lSQL.Criteria[0].Value := '1221';

    {set payment method search value}
    lSQL.Criteria[1].Value := 'Visa';

    {set order date search value}
    lSQL.Criteria[2].Value := '12/31/1990,12/31/1999';

    lSelectedList := TList.Create;

    {add parentheses}
    lSelectedList.Clear;
    lSelectedList.Add(TObject(1));
    lSelectedList.Add(TObject(2));
    lSQL.AddParentheses(lSelectedList);

    {add OR}
    lSQL.InsertCriteria(1, dacrOr);

    lSelectedList.Free;

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

    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.