Page 1 of 1

Relationship not working

Posted: Mon Mar 22, 2010 9:03 am
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

Relationship not working

Posted: Mon Mar 22, 2010 5:34 pm
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.

Relationship not working

Posted: Tue Mar 23, 2010 8:24 am
by scot
Here is a sample that reproduces the problem

Thank you for your help, this is important

Relationship not working

Posted: Tue Mar 23, 2010 10:44 am
by scot
Here is a project that reproduces the problem.

Thank you for looking at this, it is important

Relationship not working

Posted: Wed Mar 24, 2010 7:11 am
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.

Relationship not working

Posted: Wed Mar 24, 2010 8:19 am
by scot
Thank you, it works now!

Relationship not working

Posted: Wed Mar 24, 2010 10:25 am
by Andrew
We are always ready to help you! :biggrin: