Symptom
- How to pass multiple values to a subreport?
- A report contains a multiple-value or multiple-range parameter, as well as a subreport. How can you link the subreport to the values entered in the multiple-value or multiple-range parameter?
Environment
- SAP Crystal Reports 2013
- SAP Crystal Reports 2016
- SAP Crystal Reports 2020
Resolution
- You can now link a subreport directly to a multiple-value or multiple-range parameter on the main report in Crystal Reports.
- To link a subreport to the main report using multiple-value or multiple-range parameters:
- In Crystal Reports, open the report.
- On the main report, right-click the subreport object, and select: 'Change Subreport Links'
- Ub the 'Subreport Links' dialog windowm under the 'Available fields' list, select the parameter and click > to move it to the 'Field(s) to Link to' list. Two more boxes appear at the bottom of the dialog box.
- In the 'Select data in subreport based on field' box, select the field in the subreport that you want to link to the parameter in the main report.
- Click 'OK' to return to the main report.
- Right-click the subreport object, then click 'Edit Subreport'. This takes you to the subreport, in Design view.
- On the 'Report' menu, click 'Edit Selection Formula', and point to 'Record'. The Record Selection Formula Editor appears. The record selection formula contains a line similar to:
{Table.Field} = {?PM-parameter name}
- Change this line to use the IN function instead of an equals sign:
{Table.Field} IN {?PM-parameter name}
- Save the formula, close the Formula Editor, and return to the Design tab of the main report.
The next time you preview the report, the subreport only returns records that match what was entered in the multiple-value and/or multiple-range parameter for the main report.
Keywords
linking, subreport, multiple, value, range, parameter Seagate Crystal Reports Passing parameter values to subreport Simpler to link subreport to main report on multi-val parameters in version 8 , c2007138 , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , How To
Product
SAP Crystal Reports 2013 ; SAP Crystal Reports 2016 ; SAP Crystal Reports 2020