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

Trouble binding sub report based on repeating data from parent (master) report

1 Answer 64 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Justin Brouwer
Top achievements
Rank 1
Justin Brouwer asked on 12 Feb 2010, 08:48 PM

Hello,

My team is very excited to move into Telerik Reports, however we have first been trialling the software and came accross an issue that we are unable to solve.  Unfortunately we're on a tight deadline, and would sincerely appreciate any prompt responses.

[See Sample Project, Code & screenshot: http://www.addeight.net/telerik-issue.zip]


We are having trouble binding a sub report based on repeating datafrom a parent (master) report. What we need to be able to do is have a masterreport that repeats SolutionIDs (the primary key), and sub reports (which holdall the totals/information based off a single SolutionID). I cannot useFilters, as the data being returned in the sub reports is complicated.

We have seen these articles as references, and have tried (to our knowledge)everything in them:

http://www.telerik.com/community/forums/reporting/telerik-reporting/i-need-to-know-when-to-pass-parameters-to-a-subreport.aspx

http://www.telerik.com/documents/TelerikReporting-LearningGuide.pdf

http://www.telerik.com/community/forums/reporting/telerik-reporting/how-do-i-pass-parameters-to-subreport-sproc.aspx

http://www.telerik.com/support/kb/reporting/designing-reports/using-data-source-with-parameters-in-telerik-reporting.aspx

http://www.telerik.com/community/forums/reporting/telerik-reporting/how-to-set-datasource-of-a-sub-report.aspx

http://www.telerik.com/community/forums/reporting/telerik-reporting/set-subreport-datasource-programmatically.aspx#421286

http://www.telerik.com/ClientsFiles/product.videos/28/

Asyou can see by the screenshot attached (Screenshot.png in root of zip file), we are close. We have used the following code 


    Public Sub New() 

        InitializeComponent() 

 

        'bind the master's datasource 

        Dim cmdMaster As New SqlCommand("SELECT * FROM Solutions WHERE CompanyID=@CompanyID", cn) 

        cmdMaster.Parameters.AddWithValue("@CompanyID", 10) 

        Dim daMaster As New SqlDataAdapter(cmdMaster) 

        Dim dt As New DataTable("Solutions") 

        daMaster.Fill(dt) 

 

        Me.DataSource = dt 

        Me.DataMember = "Solutions" 

    End Sub 

 

    Private Sub SolutionDetails_NeedDataSource(ByVal sender As Object, ByVal e As System.EventArgs) Handles SolutionDetails.NeedDataSource 

        Dim item As Telerik.Reporting.Processing.ReportItemBase = TryCast(sender, Telerik.Reporting.Processing.ReportItemBase) 

        Dim dataRow As DataRowView = DirectCast(item.DataItem, DataRowView) 

        Dim adapter As New SqlDataAdapter("SELECT * FROM Solutions WHERE ID=@SolutionID", cn) 

        adapter.SelectCommand.Parameters.AddWithValue("@SolutionID", dataRow("ID")) 

 

        SolutionDetails.ReportSource.DataSource = adapter 

 

        Test_SolutionDetail1.Debug = dataRow("ID") 

        'Me.DataSource = adapter 

    End Sub 


 

Again, we need to have the sub report on each SolutionID, and we need to be able toquery data based off that SolutionID in the sub report.

We sincerely appreciate any help in advance, and cannot stress the tight deadline we are working with enough.  If you can help, we are more than happy to compensate you for your time!


Cheers!

1 Answer, 1 is accepted

Sort by
0
Justin Brouwer
Top achievements
Rank 1
answered on 15 Feb 2010, 08:10 AM
We have resolved the issue and will post the solution when time permits.
Tags
General Discussions
Asked by
Justin Brouwer
Top achievements
Rank 1
Answers by
Justin Brouwer
Top achievements
Rank 1
Share this question
or