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

Setting Auto Search parameters for subreports

edited April 2010 in RAP
I can set the AutoSearch parameters using the report parameters as
below. How can I do something similar for subreports?

procedure ReportOnInitializeParameters(var aCancel: Boolean);
var
aParameter: TppParameter;

begin
aParameter := Report.Parameters.Items['ActivityID'];
Report.AutoSearchCriteriaByName(Report.DataPipeline.Name,
'ID').SearchExpression := aParameter.Value;

end;

Thank you


----------
Richard Harding

Comments

  • edited April 2010
    I have discovered on the Query Designer's Search tab, the parameter drop
    down box which appears to be what I need.

    However when I select the required parameter from the list, I receive a
    database error.

    The generated WHERE clause is below. It does not have a place holder
    for the parameter.

    WHERE
    ( Job_1.ID = )


    Richard Harding
  • edited April 2010

    The main report has a Report.Parameters[ ] property

    ChildReports (ie. subreport.Report) do /not/ have a Parameters property.


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited April 2010

    Starting with RB 11, you can define Report.Parameters[ ] that optionally
    have AutoSearchSettings and LookupSettings. You can also use the Query
    Designer to bind a search condition to a Parameter. For the SQL to generate
    correctly you need to specify the Parameter DataType and assign a default
    value.



    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com



    Best regards,

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