How can I pass parent's column value as parameter to child report in SSRS? - ssrs-2008

I have created master/details report from SSRS. Is it possible to pass as a parameter from parent's column value to child report. For e.g.
If I have a master report A and detail report B. From the following picture, how can I pass value of col_1 of Master_Report_A as a parameter for Details_Report_A
Any input will be appreciated.

Related

how to pass query resultset from main report to sub report

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

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.

JasperReports: Repeating subreport for each value of the list parameter

I need to develop a report in JasperReports which contains ONE sub-report but the sub-report is repeated for every value in the list parameter.for example :
Parameter List to be passed to ONE subreport : 1,2,3,4
MyReport :
Subreport(Crosstable+ page break) for value 1 of the passed parameter
Subreport(Crosstable+ page break) for value 2 of the passed parameter
Subreport(Crosstable+ page break) for value 3 of the passed parameter
Subreport(Crosstable+ page break) for value 4 of the passed parameter**
Then the Subreport will also contain another "sub-Subreport" that should be repated X time for each value, example :
Subreport(Crosstable+ page break) for value 1 of the passed parameter :
"sub-subreport"(another Crosstable) for value 1.1
"sub-subreport"(another Crosstable) for value 1.2
"sub-subreport"(another Crosstable) for value 1.3
In other words i'm trying to loop on the same subreport but with different data something like :
for(i=0; i<list.lenght();i++){
print(subreport(i));
}
I don't to know how it can be done. I hope my examples are clear. Thanks in advance
Your detail band will fire for each record. So, if your input control is $P{myCustomers} and your main report's query is:
SELECT customer_id
FROM customers
WHERE $X{IN, customer_id, myCustomers}
Then your main report will have one field, $F{customer_id}. Your subreport needs to have a parameter of its own and it will get a value from the main report. Insert your subreport into the detail band of the main report. Click on the subreport from within the main report, and then in the Properties window of the main report, click on Parameters. The "Name" column is the name of the parameter in the subreport that will accept the incoming value, and the "Expression" field is the value to pass. So if your subreport also has a parameter for customer id, the name is customer_id and the expression to pass is $F{customer_id}.
The iReport documentation (http://community.jaspersoft.com/documentation/ireport-ultimate-guide) has information about subreports on page 90.
Try using report groups: the group is based on a value or on expression then you can embed subreport into the group.

How to pass variable's value from subreport to main report and show/hide detail band on the basis of that value in iReportDesigner Jasper Reports?

I am storing Value of one field in a variable in subreport. This variable I am returning to Main report. On the basis of this value I want to show/hide detail band 2. But I am not able to implement this as the value returned by the subreport is always Null which is a shock to me as when I am displaying the same value in subreport itself it is giving me 2 (integer). Please help me out with this.
For the First part of your question
The value returned by the subreport is always Null
In your Main report please cross check the following things.
You return variables from your sub report as in specified in here.
If the subreport and the text field in which you're using the returned value are placed on the same band, you need to set evaluationTime="Band" for the text field.
For the later part of your question,
I want to show/hide detail band 2
Using the report inspector, select detail band 2.
Access the properties of the band, using the properties tab.
You can find the property PrintWhenExpression.
Edit its value to hide/display detail band 2.
The second part of the answer works on the following logic
PrintWhenExpression will be evaluated at the start of the band rendering process, before starting to render the elements.
So, if the sub-report too is in the same band, detail band 2 in your case, this method would not hold good.

SSRS two datasets need to use field from one dataset as a parameter in second?

The issue is that the in field that has the data is just one record in the data set pulled from a set stored proc (not touchable).
Then using it as a parameter in the second dataset. Any help would be appreciated.
Add parameter
Select parameter visibility as Hidden
Go to Default Values: (Screenshot of below)
Select "Get values from a query" (and select your first dataset and value field)
In Dataset 2 filter the data with your new parameter
i.e. SELECT * FROM XYZ WHERE ABC IN (#Param)
You can do this using a subreport.
Add a subreport to the main report.
Add a parameter to the subreport.
Open the rdl of the subreport, add a paramter with the same name.
create a dataset in that RDL using your query for example
select * from YourTable where ENTY_KEY = (#param)