Page 1 of 1

Master Component not displaying when child component empty

Posted: Tue Mar 12, 2013 10:21 pm
by aaronrc
I have a report that uses a master data band and several child data bands that all reference the master data band. The report displays correctly except when there is no data to display in the child data bands in which case the master band will also not be displayed. I need the master band to be displayed irrespective of whether there is any matching child data or not.

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();
        }
   }

Re: Master Component not displaying when child component emp

Posted: Thu Mar 14, 2013 8:32 am
by Alex K.
Hello,

Please try to set the PrintIfDetailEmpty property to true for the master databand component.

Thank you.

Re: Master Component not displaying when child component emp

Posted: Thu Mar 14, 2013 10:09 pm
by aaronrc
That was the fix, thanks.

Re: Master Component not displaying when child component emp

Posted: Fri Mar 15, 2013 5:58 am
by Alex K.
Hello,

We are always glad to help you!
Let us know if you need any additional help.

Thank you.