Implementing a Bulk Summary Report

Home » Report development » Implementing a Bulk Summary Report
Report development No Comments

In O-Calc Pro there exists the concept of a “Bulk Summary Report”. This is a report where a compact bit of information for each of a collection of poles (as determined through the batch report system) is added to a single report page. This is as opposed to the normal report where each pole is represented by a single page or pages.

Implementing a Bulk Summary Report is very nearly identical to a normal report.

First change the report’s “Type” property to return “REPORT_TYPE.BULK_SUMMARY”.

  1. public override REPORT_TYPE Type { get { return REPORT_TYPE.BULK_SUMMARY; } }

Next implement the report as normal. It is important to remember that unlike a normal report the method “CreateReport” will be called once and the method “AddPole” will be called MULTIPLE TIMES!

In previous examples we sometimes see that the header (for example) is implemented in the “AddPole” section, in a bulk report it must be implemented in the “CreateReport” section.

  1. public override void CreateReport(PPLMain pPPLMain, List<FileInfo> pSelectedFiles)
  2.         {
  3.             cPPLMain = pPPLMain;
  4.             string groupName = Name;
  5.             foreach (FileInfo finfo in pSelectedFiles)
  6.             {
  7.                 string str = System.IO.Path.GetDirectoryName(finfo.FullName);
  8.                 int idx = str.LastIndexOf('\\');
  9.                 groupName = str.Substring(idx + 1);
  10.                 break;
  11.             }
  13.             cDocument = new MigraDoc.DocumentObjectModel.Document();
  14.             cPPLMain.BuildStandardGroupReportHeader(cDocument, "Capacity Summary Report", groupName);
  16.             MigraDoc.DocumentObjectModel.Paragraph paragraph = cDocument.LastSection.AddParagraph("\n");
  17.             paragraph.Format.Borders.Top.Color = MigraDoc.DocumentObjectModel.Colors.Blue;
  18.             paragraph.Format.Borders.Top.Width = new MigraDoc.DocumentObjectModel.Unit(.025, MigraDoc.DocumentObjectModel.UnitType.Inch);
  19.             paragraph.Format.Alignment = MigraDoc.DocumentObjectModel.ParagraphAlignment.Center;        
  20.         }

Now we implement a section that adds a new paragraph, table, row, etc. depending on the output we desire. For example…

  1. public override void AddPole(PPLPole pPole, String pPoleName)
  2.         {
  3.             while (cPPLMain.cCapReport.poleCapacitySummary1.GuyWireStatus.Text.EndsWith("..."))
  4.             {
  5.                 System.Threading.Thread.Sleep(500);
  6.                 cPPLMain.UpdateCapacitySummaryView();
  7.             }
  8.             String poleName;
  9.             if (pPoleName == null || pPoleName.Trim() == String.Empty)
  10.             {
  11.                 poleName = " " + pPole.GetValueAndConvertToString("Pole Number");
  12.             }
  13.             else
  14.             {
  15.                 poleName = pPoleName;
  16.             }
  17.             cPPLMain.CapacitySummaryViewToMigraDoc(cDocument.LastSection, poleName, "Summary of ");
  18.             cDocument.LastSection.AddParagraph("\n");
  19.         }

Now this report will appear in the “Bulk Reports” section of the batch reporting tool but WILL NOT be included in the normal reports tab of the main user interface. When select all of the poles in a batch report will be included in order on a single report which will be placed at the beginning of a merged report (if one was requested).