Data Tables Used in General Purpose Reports

Where does Patchworks get the information (data) to create a report? To understand the set up of the General Purpose Reports, we will first have to look at data tables. Tables contain rows and columns of data. Patchworks reports use four different types of tables in creating reports. These are the block table, the target table, the route table and crosstab tables. Actually Patchworks is so flexible, that if you should have the need, any datatable, e.g. the dbase file associated with a shape file, can be used.

By now you should be familiar with the block table (see the section called “The Block Attribute Table”). It contains a record for every Patchworks block in your model. The target table (see the section called “ The Target Table ”) contains a record for each of the targets in your model. The BlockTable and TargetTable are internal Patchworks tables that keep track of all the necessary 'book keeping' while the model is running. These tables are most often used to create reports and are referenced through the method control.getTargetTable() or control.getBlockTable(). The route table contains a record for every road segment in the model. It is used for route reports as it contains information on building, maintainance and hauling costs as well as the length of each road segment. You can also calculate a new table from an existing table using the CrosstabStore subclass. You'll find out about crosstab stores soon (Crosstab Stores).

If for some reason you wish to construct a report based on information from attributes of a shapefile or coverage it's not a problem!

To do this, the file can be opened and given a variable name to be used when defining any type of report. Use the GeoRelationalStore class with the open method (see the Patchworks Application Programming Interface (API) Reference for more detailed info).

   GeoRelationalStore fragment =
   GeoRelationalStore.open("../data/fragments.shp");
 

Now the variable name fragment can be used at the AttributeStore when defining reports. This method can be used anywhere in the PIN file to open shape files and coverages.

In the parlance of Patchworks, all these tables are referred to as AttributeStores. The AttributeStore is a fundamental base class for representing tabular data. Patchworks implements many tables to provide access to the inner workings of the model data. When a report asks for an attribute store, you must supply one of the tables discussed above.