Relations not automatically generated?
Posted: Wed Jun 04, 2008 6:17 am
Hi,
I have a Dataset with three tables and two relations designed and add it in the following way to my report
The Problem is that my relations from the DataSet don't appear in the designer. I have to add them manually:
Are I am doing something wrong?
Regards,
Chris
I have a Dataset with three tables and two relations designed and add it in the following way to my report
Code: Select all
DataSet set = ReportManager.GetDataSet(ViaContext, _Report.ReportType, reportSearch);
StiReport stiReport = new StiReport();
stiReport.RegData(set);
stiReport.Load(_Report.ReportObject.BinaryData);
// Clear
stiReport.Dictionary.DataSources.Clear();
stiReport.Dictionary.Relations.Clear();
stiReport.Dictionary.Synchronize();
ReportHelper.GenerateRelations(set, stiReport);
stiDesigner.Report = stiReport;
Code: Select all
foreach (DataRelation relation in set.Relations)
{
StiDataRelation stiRelation = new StiDataRelation(relation.RelationName,
report.DataSources[relation.ParentTable.TableName],
report.DataSources[relation.ChildTable.TableName],
new string[] { relation.ParentColumns[0].ColumnName },
new string[] { relation.ChildColumns[0].ColumnName });
report.Dictionary.Relations.Add(stiRelation);
}
Regards,
Chris