How can we pass a parameter from main report to subreport in crystal reports XI
Asked Answered
I

7

34

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 want to pass the same parameter to subreports. Please help me.

Inebriate answered 20/1, 2010 at 4:57 Comment(0)
I
47

Right-click on the subreport object and choose Change SubReport Links, then select how the parameter is to be used by the subreport.

Subreport linking of paramters

Iceni answered 20/1, 2010 at 13:13 Comment(0)
O
10

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;
Ocker answered 2/7, 2010 at 13:10 Comment(0)
D
1

Perform following easy steps:

  1. Create New Parameter lets say "StartDate" in Parameter Fields in Field Explorer in Crystal Report
  2. Create New Parameter lets say "StartDateSubReport" in Parameter Fields in Field Explorer in your Subreport
  3. Now in Main report file, Right Click Subreport lets say "EmployeesList.rpt" and click Change Subreport Links menu
  4. Select "StartDate" from Available Fields from Available Fields Tab and click on ">" button to make it vailable to link in subreport
  5. Now bind your "StartDate" which you have made available by selecting it with "StartDateSubReport" in dropdown available in "Subreport Parameter Field to use"
Dormant answered 12/8, 2019 at 10:55 Comment(0)
A
0

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

Anticyclone answered 2/4, 2015 at 11:28 Comment(0)
M
0

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.

Milldam answered 2/8, 2016 at 8:36 Comment(0)
S
0

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

Shrug answered 4/3, 2017 at 9:34 Comment(0)
S
0

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

Sphinx answered 6/10, 2018 at 11:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.