how to pass query resultset from main report to sub report - jasper-reports

I have a main report which executes a query.I want that result set values to pass into the sub report.How to do in ireport.
Please give me the suggestions.

The query in the main report will generate some fields. Create a subreport parameter (for the sub-report from the main report) called "paramA" and pass it the value you wish by setting the report expression as needed using $F{myField} as the expression.
Then in the sub-report create a parameter called "paramA" to receive the value from the main report. See this

Related

Pass specific value to sub-report from main report

I need some help with a report I have in Crystal Reports. I have a subreport that runs in the details section of my main report. My main report is structured/grouped like this:
MainPartNumber
ChildPartNumber
Sequence
My subreport is relative to a specific ChildPartNumber & Sequence (these parameters & arguments are passed to the subreport). Users are requesting that the subreport appear in the header of my main report. Is this possible?
I appreciate any help.

Crystal Reports SubReport parameter has multiple values

I have a report where I have created a subreport that uses a parameter from the main report but that value in the main report returns multiple of the parameter. Is there a way to specify in the parameter to only pull a distinct value into the parameter?
You could write a Formula to filter out the parameters you don't want, then pass that entire Formula as a parameter to the subreport.

Crystal Reports: Setting subreport parameters with one main report parameter [duplicate]

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.
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

My parameters on my main report won't add to my subreport in crystal reports

I have done this before, where the main report's parameters are passed on to the subreport. Currently, there are 2 parameters from the main report being passed to my subreport, but I need to add 2 more. When I go through the "Change Subreport Links" option and select and add the needed parameters, it simply doesn't save. I am not sure how else to add these.
Steps:
create desired parameters in sub-report
create corresponding parameters in main report
link with 'linking expert'
The datatypes of the parameters fields did not match, so the two were not correlating.

Passing values from main report to subreport in JasperReports

I have a simple select sql query with 2 parameters that I want it to be in my query text in main report. It returns about 100 values that I want to put in 10 subreports (10 values per subreport). On main report I need to display only one parameter. All the values from query I need to be in subreports. How do I pass them?
Connection to database is returned to me from application, parameter values also. I'm using iReport 4.7.0.
Parameters are attached to the dataset, if you expand the dataset itself, you'll find a section there for parameters, just like in your main report.
You'll need to link the parameters together though, using the connection properties where you're actually using the dataset, eg, in a chart or a table. For example, in the table, you go to the dataset tab of the properties pane, and click on the parameters button to map the parameters between your main report and your sub dataset.
More here.