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