Parameters and Constructors

A Category Pattern Report is defined in the PIN file by specifying ten simple parameters. A Category Pattern Report allows you to group information into categories or "ranges" defined and constructed in the PIN file, based on the required information. Once this range has been constructed it can be referred to over and over again by using the "range name". The labels which appear between the parentheses will appear as the row headings in the HTML table and along the X-axis of the PNG bar chart. The numbers which follow (separated by commas) are the lower and upper limits of the ranges, used to categorize each value. If the range values overlap, the cell value will be placed in the first range that satisfies the conditions. In this example, the range was given a name of "ageClass".

Example 20. Creating a new Range in the PIN file

	    RangeLabel[] ageClass = new RangeLabel[] {
	    new RangeLabel("Regen", -5, 0),
	    new RangeLabel("0 - 20", 1, 20),
	    new RangeLabel("20 - 40", 20, 40),
	    new RangeLabel("40 - 60", 40, 60),
	    new RangeLabel("60 - 80", 60, 80),
	    new RangeLabel("80 - 100", 80, 100),
	    new RangeLabel("100 - 120", 100, 120),
	    new RangeLabel("120 - 140", 120, 140),
	    new RangeLabel("140+", 141, 9999)

Row categories can also be defined as an 'array' of values. There are several ways to define an array. If you know the actual values from the column that you wish to use at the row headings, you can define an array as follows (prior to defining the report):

Example 21. Creating a new Category Array in the PIN file

	    Object [] values = new Object [] {"A","B","C"};

If you do not know the exact values from the category column you wish to use, an advanced method allows you to search the entire column for all unique values and use each unique value as a row heading. Each unique value in the column creates a row heading, in this case all the different "LMUs" make a single row (A,B,C,CH...). A predefined array which creates the actual row headings from the column values would be defined in the PIN file as follows:

Example 22. Creating a Category with all values from column in the PIN file

	    (Object[] lmus = control.getBlockTable().uniqueValues("LMU"); 

More information regarding these advance methods is available in the ReportWriter section of the Patchworks Application Programming Interface (API) Reference or Contact Spatial Planning Systems for more information.

The following shows the construction of a Category Pattern Report.

  public CategoryPatternReport (String filename,                
                         String title,                  
                         String units,                   
                         AttributeStore sourceDataTable, 
                         String reselectExpression,
                         int[] periods,
                         boolean annualize,
                         String additionalHTML,
                         boolean percent,
                         String categoryExpression,         1
                         Comparable[] categories,           2
                         String pattern)                    3


categoryExpression - The database expression containing values used to classify records into a table column.


categories - An array of String labels providing the row names to be used for this table. For example: this array searches the LMU column of the Block Table for unique values. Each unique value will have a seperate row, which will be totalled at the end.

	      Object[] lmus = control.getBlockTable().uniqueValues("LMU");



pattern - The prefix used to find database columns that will compose the columns of the report, where all matching columns will be used. The columns in the data source table that match the prefix will create the columns of the HTML table however the prefix will be removed (For example: "product.Area.managed" will be searched for and the unique attributes will be used to create the columns. Unique attributes may be product.Area.managed.conif and product.Area.managed.decid, however the columns will appear as "conif" and "decid".