Multiple reports from a single report definition
It is often the case that there might be two (or more) versions of a report in O-Calc Pro. For example a summary version and a detailed version, or a text only version and a version that includes images or charts (see http://o-calcpro.com/wiki/2015/12/03/adding-a-custom-chart-to-a-report/ ). Rather than implementing such reports in multiple report definitions you can simply set a singe definition to do it as follows:
Override the property “SubtypesCount” and return the number of ADDITIONAL reports that will be implemented. The report always implements one report so if you wish to implement a total of 4 (for example) you would have this property return 3.
-
//implement more than one additional report subtype (total will be this number plus the master)
-
public override int SubtypesCount { get { return 3 ; } }
Next we must indicate the name that each report will have by updating the “Name” property (and also the “Description” assuming it does not simply reflect the value of “Name”).
Here we see the value “Subtype” used where O-Calc Pro indicates which report it is asking to be processed.
-
public override String Name
-
{
-
get
-
{
-
switch (SubtypeIndex )
-
{
-
default :
-
case 0 :
-
return "Analysis Summary" ;
-
case 1 :
-
return "Analysis Report" ;
-
case 2 :
-
return "GO95 Analysis Summary" ;
-
case 3 :
-
return "GO95 Analysis Report" ;
-
}
-
}
-
}
It is important that each of these values be unique so that the user will know which report is which and will be able to filter them individually.
Finally the implementations of “public override void CreateReport(PPLMain pPPLMain, List
In this way reports that share portions of their implementation can be contained in a single report definition for ease of implementation and maintenance.
-
public override void AddPole (PPLPole pPole, String pPoleName )
-
{
-
switch (SubtypeIndex )
-
{
-
default :
-
case 0 :
-
BuildSummaryReport ( false ) ;
-
case 1 :
-
BuildDetailedReport ( false ) ;
-
case 2 :
-
BuildSummaryReport ( true ) ;
-
case 3 :
-
BuildDetailedReport ( true ) ;
-
}
-
}