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

Error adding more than 1 searchcriteria in TdaSQLBuilder

edited October 2017 in End User
Hello,

In a report which has two queries, the main query has one searchcriteria
and I use this code in the report design to copy the searchcriteria to
the second query:

procedure ReportBeforeOpenDataPipelines;
var
lb : TdaSQLBuilder;
begin
lb := TdaSQLBuilder.Create(v_patient_procedure_summary);
lb.SearchCriteria.Add('v_patient_procedure_summary',
'proceduredate', 'Between', report.autosearchfields[0].searchexpression);
lb.free;
end;

and the report gives the expected result.

However, if I add another searchcriteria to the first query and modify
the code above thus:


procedure ReportBeforeOpenDataPipelines;
var
lb : TdaSQLBuilder;
begin
lb := TdaSQLBuilder.Create(v_patient_procedure_summary);
lb.SearchCriteria.Add('v_patient_procedure_summary',
'proceduredate', 'Between', report.autosearchfields[0].searchexpression);
lb.SearchCriteria.Add('v_patient_procedure_summary', 'siteid', '=',
report.autosearchfields[1].searchexpression);
lb.free;
end;

I get the error : Incorrect syntax near ')'

Can you help please?

Thanks,
Arthur

Comments

  • edited October 2017
    Hi Arthur,

    Which version of ReportBuilder and Delphi are you using? Also which DB
    and connectivity are you currently using?

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2017
    Hi Nico,

    Profuse apologies.

    This is older application which needs a report modified.

    RB 9.02 and D2005

    Arthur
  • edited October 2017
    SQL Server 2008 and ASTA(!!)

  • edited October 2017
    Scratch that, it is SQL Server 2008 using ADO


  • edited October 2017
    Hi Arthur,

    You are using a very old version of ReportBuilder and Delphi.

    In my testing with the latest version of both, and RAP code very similar
    to yours, everything compiled and functioned correctly. It's possible,
    this was a bug that was fixed for a later version.

    Please consider upgrading your development tools regularly to take
    advantage of new features as well as timely fixes.

    --
    Best Regards,

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