The code snippet below will correctly display the report (a cut down report template that illustrates my issue is attached). If I break the link between the master data source (which is IncidentLog) and the child data source (which is IncidentLogComment) by commenting the line, IncidentID = Guid.Empty.ToString(), then no data will be displayed. How can I get the master IncidentLog data source to display even when there is no matching IncidentLogComment?
Code: Select all
public class IncidentLogReportEntity
{
public string ID { get; set; }
public int IncidentNumber { get; set; }
public string LocationName { get; set; }
public DateTime IncidentDateTime { get; set; }
public string WerePoliceCalled { get; set; }
public string IsReportable { get; set; }
public string ManagerPreferredName { get; set; }
public string InsertedByPreferredName { get; set; }
public string IncidentTypesCSV { get; set; }
public string IncidentDetail { get; set; }
public string IncidentAction { get; set; }
}
public class IncidentLogCommentEntity
{
public string IncidentID { get; set; }
public int IncidentCommentNumber { get; set; }
public string Comment { get; set; }
public DateTime Inserted { get; set; }
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Report Designer");
IncidentLogReportEntity incident = new IncidentLogReportEntity()
{
ID = Guid.Empty.ToString(),
IncidentNumber = 1,
IncidentDateTime = DateTime.Now,
IncidentDetail = "Blah blah blah..."
};
IncidentLogCommentEntity comment = new IncidentLogCommentEntity()
{
IncidentID = Guid.Empty.ToString(),
Comment = "Blah blah..."
};
StiReport report = new StiReport();
report.Load("IncidentLogReport.mrt");
report.RegData("IncidentLog", new List<IncidentLogReportEntity> { incident });
report.RegData("IncidentLogComment", new List<IncidentLogCommentEntity> { comment });
report.Compile();
report.Design();
//report.ExportDocument(Stimulsoft.Report.StiExportFormat.Pdf, "incident_log_report.pdf");
Console.WriteLine("Press any key to exit...");
Console.Read();
}
}