Implementing a Bulk Summary Report
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”.
-
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.
-
public override void CreateReport (PPLMain pPPLMain, List <FileInfo > pSelectedFiles )
-
{
-
cPPLMain = pPPLMain ;
-
string groupName = Name ;
-
foreach (FileInfo finfo in pSelectedFiles )
-
{
-
string str = System.IO . Path . GetDirectoryName (finfo . FullName ) ;
-
int idx = str . LastIndexOf ( '\\' ) ;
-
groupName = str . Substring (idx + 1 ) ;
-
break ;
-
}
-
-
cDocument = new MigraDoc . DocumentObjectModel . Document ( ) ;
-
cPPLMain . BuildStandardGroupReportHeader (cDocument, "Capacity Summary Report", groupName ) ;
-
-
MigraDoc . DocumentObjectModel . Paragraph paragraph = cDocument . LastSection . AddParagraph ( "\n" ) ;
-
paragraph . Format . Borders . Top . Color = MigraDoc . DocumentObjectModel . Colors . Blue ;
-
paragraph . Format . Borders . Top . Width = new MigraDoc . DocumentObjectModel . Unit ( .025, MigraDoc . DocumentObjectModel . UnitType . Inch ) ;
-
paragraph . Format . Alignment = MigraDoc . DocumentObjectModel . ParagraphAlignment . Center ;
-
}
Now we implement a section that adds a new paragraph, table, row, etc. depending on the output we desire. For example…
-
public override void AddPole (PPLPole pPole, String pPoleName )
-
{
-
while (cPPLMain . cCapReport . poleCapacitySummary1 . GuyWireStatus . Text . EndsWith ( "..." ) )
-
{
-
System.Threading . Thread . Sleep ( 500 ) ;
-
cPPLMain . UpdateCapacitySummaryView ( ) ;
-
}
-
String poleName ;
-
if (pPoleName == null || pPoleName . Trim ( ) == String . Empty )
-
{
-
poleName = " " + pPole . GetValueAndConvertToString ( "Pole Number" ) ;
-
}
-
else
-
{
-
poleName = pPoleName ;
-
}
-
cPPLMain . CapacitySummaryViewToMigraDoc (cDocument . LastSection, poleName, "Summary of " ) ;
-
cDocument . LastSection . AddParagraph ( "\n" ) ;
-
}
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).