This is a migrated thread and some comments may be shown as answers.

Master Detail with stored procedures and parameters on both

1 Answer 159 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mike Maynard
Top achievements
Rank 1
Mike Maynard asked on 03 Apr 2014, 12:34 PM
Hi all,
I have been trying different things to try and get this to work but keep running into walls.
My setup is:

Visual Studio 2012 - Winforms - Telerik Reporting 2013 Q3
SQL Server 2008R2 backend.

Master table
name: JSA1
Key Field: JSAID
Field1
Field2
Field3
Field4

Detail Table
name: tblSteps
Key Field: STEPID
FK Field: JSAID
Field1
Field2
Field3
Field4

Foreign key is setup properly in SQL Server.
I have 2 stored procedures that select records from each of the tables.
I can preview the reports individually with an entered parameter value and they both work fine.
What I want to accomplish is to be able to pass the parameter to BOTH the main report and the subreport.
I followed the Master Detail guide, and that works ok, but it is slow since it has to return ALL of the detail table before it filters then down to the records I want.

I call the master report using a form with a reportviewer on it and pass the parameter to the main report as follows
 Dim instanceReportSource As New Telerik.Reporting.InstanceReportSource()
                instanceReportSource.ReportDocument = New Reporting.VWIDetail()
                instanceReportSource.Parameters.Add(New Telerik.Reporting.Parameter("JSAID", GlobalVariables.VWILinkDetail))
                ReportViewer2.ReportSource = instanceReportSource
               ReportViewer2.RefreshReport()

How can I pass that parameter to the sub report in the same way?




1 Answer, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 08 Apr 2014, 10:38 AM
Hello Mike,

You can set the sub-report parameters programmatically like in the following code snippet:
...
Dim report = New Reporting.VWIDetail()
Dim subReport = TryCast(report.Items.Find("MySubReportItemName", True)(0), Telerik.Reporting.SubReport)
subReport.ReportSource.Parameters.Add("Parameter1", "value")
...

Regards,
Nasko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
Mike Maynard
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Share this question
or