Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Download and install the Jaspersoft Studio application. This is free, open source software from Jaspersoft, which you can download from:
    from https://community.jaspersoft.com/project/jaspersoft-studio/releases.
  2. Read the tutorials on the same page (and any others that you find useful): https://community.jaspersoft.com/wiki/jaspersoft-studio-tutorials-archive
  3. Ensure you have at least read-only access to the database. If you are working on the server that hosts CollectionSpace, the default configuration will allow access. Otherwise, you need to have your admin allow remote access to the database by editing the PostgreSQL configuration files:
    1. In the main postgresql.conf file, there must be an entry like:

      Code Block
      listen_addresses = 'localhost, {your-machine}'        # what IP address(es) to listen on;

      where you or your administrator will replace "{your-machine}" with the IP address or hostname of the computer from which you will be connecting when you're authoring reports. See also the PostgreSQL documentation on Connections and Authentication.

    2. In PostgreSQL's host-based authentication file, pg_hba.conf, there must be an entry for a PostgreSQL database user account that will be given read-only privileges to the nuxeo database, for the purpose of performing queries and running reports. The following example specifies that access is granted to the nuxeo database to the PostgreSQL database user account named "reader," for remote connections from IP address 172.20.143.89, via username and password authentication (md5).

      Code Block
      host nuxeo reader 172.20.143.89/32 md5

      (In the example above, replace the example IP address given there with the actual IP address of the machine you will be connecting from. In place of specifying an individual IP address, you can instead specify a subnet range of addresses. For details, see the PostgreSQL documentation on the pg_hba.conf file..)

...

Follow the instructions in the CollectionSpace User Manual to create a project in Jaspersoft Studio and establish a connection to CollectionSpace: Creating and Running a CollectionSpace Report in Jaspersoft Studio.

A report retrieves the data to display using SQL. Here is an example SQL query that gets field values from Acquisition records:

Code Block
SELECT
acquisitions_common."originalobjectpurchasepricevalue" AS acquisitions_common_originalobjectpurchasepricevalue,
acquisitions_common."transferoftitlenumber" AS acquisitions_common_transferoftitlenumber,
acquisitions_common."acquisitionreferencenumber" AS acquisitions_common_acquisitionreferencenumber,
acquisitions_common."acquisitionmethod" AS acquisitions_common_acquisitionmethod,
acquisitions_common."acquisitionauthorizerdate" AS acquisitions_common_acquisitionauthorizerdate,
acquisitions_common."acquisitionauthorizer" AS acquisitions_common_acquisitionauthorizer,
acquisitions_common."acquisitionreason" AS acquisitions_common_acquisitionreason
FROM
"public"."acquisitions_common" acquisitions_common
INNER JOIN "public"."hierarchy" hierarchy ON acquisitions_common."id" = hierarchy."id"
INNER JOIN "public"."collectionspace_core" core ON acquisitions_common."id" = core."id"
INNER JOIN "public"."misc" misc ON misc."id" = hierarchy."id"
WHERE core.tenantid = $P{tenantid} AND misc.lifecyclestate != 'deleted'
$P!{where_clause}

The above query contains clauses to constrain the results to the appropriate tenant, and to filter out documents that have been soft-deleted (marked as deleted, but still present in the database). The tenant ID has been specified as a property (tenantid) in the report, and the property value is used in the query. CollectionSpace will pass in the current tenant ID when the report is run on the CollectionSpace server, so the same report can be used for different tenants in the system. For your testing, set the tenantid property to have a default value corresponding to the tenant you most commonly use. This id is the one specified in the tenant configuration file for the services, for your tenant. See also: Creating your new tenant.

...

The effect of this definition is to look for a csid parameter passed in from CollectionSpace, and produce a report on that single record if it is set. If the value is not set by CollectionSpace (when the report is run without any context), the report is run on all records (of a certain type). Authoring a report this way allows it to be run either for a single record (from the record editor screen), or without a context (from the Tools/Reports screen).

...