Relationship not working

Stimulsoft Reports.NET discussion
Post Reply
scot
Posts: 7
Joined: Tue Feb 16, 2010 12:30 pm

Relationship not working

Post by scot »

v2009.3.600
Framework v2.0.50727

I have DataBand1 (DataSource1) surrounded by GroupHeader1 and GroupFooter1. GroupHeader1's Sort property=None, Condition={CompanyID} Inside GroupFooter1 I have a Panel1. Inside Panel1 I have DataBand2 (DataSource2) surrounded by HeaderBand1 and FooterBand1. I have a Relationship1 between DataSource1 and DataSource2 on a CompanyID column. DataBand2 has Databand1 set as the master and relationship set to Relationship1.

Both datasources are not populated from a SQL query, instead a .NET dataset is built with datatables corresponding to the 2 databand datasources. Both datatables are registered with regData

DataBand1 displays the data as intended but the child (DataBand2) displays the entire recordset (DataSource2) instead of only data for the current CompanyID. If I completely remove the relationship I get the same report, it is as if my relationship is being ignored.

Thanks for your help
Scot
Attachments
367.PayrollEdit.mrt
(103.78 KiB) Downloaded 220 times
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

Relationship not working

Post by Ivan »

Hello,

We couldn't reproduce this bug on our reports.
Sorry, can you provide data for your report or sample project for this issue?

Thank you.
Attachments
369.Report sample.zip
(2.23 KiB) Downloaded 191 times
scot
Posts: 7
Joined: Tue Feb 16, 2010 12:30 pm

Relationship not working

Post by scot »

Here is a sample that reproduces the problem

Thank you for your help, this is important
Attachments
371.StimulsoftIssue.zip
(90.96 KiB) Downloaded 212 times
scot
Posts: 7
Joined: Tue Feb 16, 2010 12:30 pm

Relationship not working

Post by scot »

Here is a project that reproduces the problem.

Thank you for looking at this, it is important
Attachments
372.StimulsoftIssue.zip
(94.4 KiB) Downloaded 190 times
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

Relationship not working

Post by Ivan »

Hello,
scot wrote:Here is a project that reproduces the problem.
Please modify your code:

Code: Select all

            'load the report
            Dim loReport = New Stimulsoft.Report.StiReport
            loReport.Load(Application.StartupPath & "\payrolledit.mrt")

            loReport.DataSources.Clear()

            'pass in each dataset table 
            For Each ldtTable As DataTable In mdtDataSet.Tables
                loReport.RegData(ldtTable.TableName.ToString, ldtTable)
            Next

            'make report aware of new dataset columns
            loReport.Dictionary.Synchronize()

            loReport.Dictionary.RegRelation(New StiDataRelation("EmployeePTSummary", loReport.Dictionary.DataSources("Employee"), loReport.Dictionary.DataSources("PTSummary"), New String() {"Company_Num"}, New String() {"Company_Num"}))
            loReport.Dictionary.RegRelation(New StiDataRelation("EmployeeDistributionSummary", loReport.Dictionary.DataSources("Employee"), loReport.Dictionary.DataSources("DistributionSummary"), New String() {"Company_Num"}, New String() {"Company_Num"}))

            'make report aware of new relations
            loReport.Dictionary.Synchronize()

            Dim loDatabandMaster = DirectCast(loReport.GetComponentByName("DataBand"), Stimulsoft.Report.Components.StiDataBand)
            Dim loChildDataband1 = DirectCast(loReport.GetComponentByName("CompanyPTDataBand"), Stimulsoft.Report.Components.StiDataBand)
            loChildDataband1.MasterComponent = loDatabandMaster
            loChildDataband1.DataRelationName = "EmployeePTSummary"

            Dim loChildDataband2 = DirectCast(loReport.GetComponentByName("CompanyDistributionDataBand"), Stimulsoft.Report.Components.StiDataBand)
            loChildDataband2.MasterComponent = loDatabandMaster
            loChildDataband2.DataRelationName = "EmployeeDistributionSummary"

            'pass in each parameter we cared to specify 
            For Each loParameter As Parameter In moParameters
                loReport.Dictionary.Variables.Add(New StiVariable(loParameter.Name, loParameter.Value))
            Next

            With Me.rptViewer
                .Dock = DockStyle.Fill
                .Visible = True
                .Report = loReport
                .Report.Render()
            End With
Thank you.
scot
Posts: 7
Joined: Tue Feb 16, 2010 12:30 pm

Relationship not working

Post by scot »

Thank you, it works now!
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Relationship not working

Post by Andrew »

We are always ready to help you! :biggrin:
Post Reply