How can we pass a parameter from main report to subreport in crystal reports XI
How can we pass a parameter from the main report to a subreport in Crystal Reports XI? I have a parameter in the main report. Now, I wan开发者_开发知识库t to pass the same parameter to subreports. Please help me.
Right-click on the subreport object and choose Change SubReport Links, then select how the parameter is to be used by the subreport.
Using CodebyMoonlight's solution requires a relation between main report and subreport.
If there is no relation between both of them, you can use Shared Variables to pass values between both of them, as shared variable can be set and displayed anywhere in main report or sub report.
Shared NumberVar x := 5;
Perform following easy steps:
- Create New Parameter lets say "StartDate" in Parameter Fields in Field Explorer in Crystal Report
- Create New Parameter lets say "StartDateSubReport" in Parameter Fields in Field Explorer in your Subreport
- Now in Main report file, Right Click Subreport lets say "EmployeesList.rpt" and click Change Subreport Links menu
- Select "StartDate" from Available Fields from Available Fields Tab and click on ">" button to make it vailable to link in subreport
- Now bind your "StartDate" which you have made available by selecting it with "StartDateSubReport" in dropdown available in "Subreport Parameter Field to use"
parameter sharing between main report and sub report "Right-click on the subreport object and choose Change SubReport Links, then select how the parameter is to be used by the subreport." works for me
I had the same problem. The main report loaded first and then the subreport. You have to load the subreport before you can use the variable.
I think that using Right Click and Sub-report Links or Shared Var Between Report and Sub-report Both using Selection formula so it is suitable for limited data only Selection formula working after loading all records from Database table ... report loading bad performance so i'm tring to limit rows by passing some parameter from C#/VB and send others from main to sub report For example if you need the transaction of items in period and you can pass the period parameter from application (c# ..) and using Sub-report Links to send itemID
https://kb.blackbaud.com/articles/Article/52328
Create a parameter field in the main report. From the main report, right click on the subreport, and select Change Subreport Links. In the subreport linking window, select the parameter field from the window labeled "Available Fields", and click on the ">" button to move it to the window on the right labeled "Fields to link to" Below, make sure you have a check next to Select data in subreport based on field. Below the checkbox, if it is not already there, select the field from the subreport, to which you would like the parameter field linked. Click OK
精彩评论