Reports in Triaster Server 2011

 This article is suitable for a Library Administrator

Ref: 201304301013
Last Edited: October 14th, 2013


Overview

Report Exchange was introduced in Triaster Server 10, as a simple way of implementing custom reports. Making additional reports available was merely a matter of adding the new report definition file (an XSL transform) to the Report Exchange folder.

In Triaster Server 2011, the report definition files have changed, but are still stored in a single, dedicated folder.

Triaster\TriasterServer2011\reports

Although a report is now defined by two files - an XSL transform to create the data, and an XML file to define the way in which the report data is displayed - creating custom reports has arguably become easier. A comparison of of the old- and new-style XSLT files show the newer ones are significantly simpler.

As with the previous system, the easiest way to create a new report is to take a copy of an existing one that most closely matches the one required, and change it to suit.

Report XSLT file

The old-style XSLTs created HTML output from Catalogue XML files. The new-style ones create XML files, and so don't include the extra HTML-generating code of the old, making their structure more straightforward to understand.

Report XML file

The report XML file primarily defines:
  •  general information as viewed in the report listing on the Reports page.
  •  the report layout - columns, captions, sort-order, etc

General information

General report information is near the beginning of the file.

  <name>Contents</name>
  <description>This report shows all activities, maps and process owners.</description>
  <category>1. General</category>
  <version>1.1</version>
  <lastModified>01/05/12</lastModified>
  <pictureURL>icon_reports_contents.png</pictureURL>

It's this that defines how a report is listed on the main Reports page.

Transform file

This is the XSL transform, which, in association with the XML file, defines the report.

    <transformFile>contents.xslt</transformFile>

Columns

Columns correspond to the columns of data as they are displayed in the report.

      <column>
        <fieldname>Name</fieldname>
        <caption>Activity Name</caption>
        <visibleindex>1</visibleindex>
        <sortindex>-1</sortindex>
        <groupindex>-1</groupindex>
        <sortorder>0</sortorder>
        <type>normal</type>
        <displayformat></displayformat>
      </column>

 fieldname  relates to a field, also defined in the XML file
 caption  column header caption
 visibleindex  order in which columns are displayed (from 0 onwards)
 sortindex  order in which columns are sorted (-1 for items not sorted; from 0 onwards for sorted items)
 groupindex  order in which columns are grouped (-1 for items not grouped; from 0 onwards for grouped items)
 sortorder  0 - not sorted; 1 - ascending; 2 - descending

Any column requires a corresponding field.

Summary

A summary is an aggregate that can be reported for groups and the whole data set.

      <groupsummary>
        .
        <summaryitem>
          <fieldname>Name</fieldname>
          <displayformat>{0} Activities</displayformat>
          <summarytype>3</summarytype>
        </summaryitem>
        .
      </groupsummary>

and

      <totalsummary>
         .
       <summaryitem>
          <fieldname>Name</fieldname>
          <displayformat>{0} Activities</displayformat>
          <summarytype>3</summarytype>
        </summaryitem>
        .
      </totalsummary>
 
 
 fieldname relates to a field, also defined in the XML file
 displayformat Examples:
 '{0} Activities' displays the number followed by "Activities".
 '{0:c}' displays a number in currency format.
 summarytype 0 - sum; 1 - minimum; 2 - maximum; 3 - count; 4 - average
 

Fields

The fields correspond to elements defined in the XSL transform file. 

In the XSLT, you may have an element called 'Name', which, in the case of the Contents report, takes its value from an Activity's name:

      <xsl:choose>
        <xsl:when test="string-length(Name)>0" >
          <xsl:element name="Name">
            <xsl:value-of select="Name" />
          </xsl:element>
        </xsl:when>
      </xsl:choose>

The element 'Name' will be defined as a field in the XML file.

      <field>
        <name>Name</name>
        <datatype>xs:string</datatype>
      </field>
 
Data types:
 
  xs:boolean
  xs:datetime
  xs:decimal
  xs:integer
  xs:string

Hints and Tips

These are more detailed tips, of which more are likely to be added as this article develops.

How to list maps (Nodes)

If a report is based on a  list of maps (Nodes), then you may expect this in the XSLT:

  <xsl:template match="ProcessNavigatorXmlCatalogue/File/Map/MapPages/MapPage/Node">

However, that would include any empty Node elements which would manifest as blank records in the report. An empty Node element would be associated with a page that didn't contain a Node, such as a background page. To avoid this, test for a Node attribute such as UniqueID.

  <xsl:template match="ProcessNavigatorXmlCatalogue/File/Map/MapPages/MapPage/Node[UniqueID!='']">

Note: this expression, UniqueID!='', contains two single-quotes, not a single double-quote.

That will list Nodes that have such an attribute with a value, and all Nodes are assigned a UniqueID.

How to list maps (Nodes), sorted by name, with a hyperlink

Perhaps the most obvious way to create a list of maps where a hyperlink is associated with the map name is with this code:

Note: These are code snippets, not the full content of the report files.

XSLT:

  <xsl:template match="ProcessNavigatorXmlCatalogue/File/Map/MapPages/MapPage/Node[UniqueID!='']">

    <xsl:element name="row">

      <xsl:choose>
        <xsl:when test="string-length(Name)>0">
          <xsl:element name="NodeName">
            <xsl:value-of select="Name" />
          </xsl:element>
        </xsl:when>
      </xsl:choose>

      <xsl:choose>
        <xsl:when test="string-length(ancestor::MapPage/HTMLURL)>0">
          <xsl:element name="HTMLLink">
            <xsl:value-of select="ancestor::MapPage/HTMLURL" />
          </xsl:element>
        </xsl:when>
      </xsl:choose>

XML:

    <columns>

      <column>
        <fieldname>HTMLLink</fieldname>
        <caption>Link</caption>
        <visibleindex>1</visibleindex>
        <sortindex>-1</sortindex>
        <groupindex>-1</groupindex>
        <sortorder>0</sortorder>
        <type>hyperlink</type>
        <displayformat></displayformat>
        <hyperlinktextfield>NodeName</hyperlinktextfield>
      </column>
    .
    .
    <fields>
      <field>
        <name>NodeName</name>
        <datatype>xs:string</datatype>
      </field>
      <field>
        <name>HTMLLink</name>
        <datatype>xs:string</datatype>
      </field>

The problem with reports such as this that list maps (Nodes) where the hyperlink is directly associated with the map name is that when sorting on the map column, the list is sorted by the hyperlink address. The workaround is to associate the hyperlink with a separate column, in the following case, a dummy column that displays an ellipsis. This fixed text element is added to the XSLT.

XSLT:

      <xsl:choose>
        <xsl:when test="string-length(ancestor::MapPage/HTMLURL)>0">
          <xsl:element name="LinkText">
            <xsl:text>...</xsl:text>
          </xsl:element>
        </xsl:when>
      </xsl:choose>

and the XML file is amended like so:

XML:

    <columns>

      <column>
        <fieldname>NodeName</fieldname>
        <caption>NodeName</caption>
        <visibleindex>0</visibleindex>
        <sortindex>-1</sortindex>
        <groupindex>-1</groupindex>
        <sortorder>0</sortorder>
        <type>normal</type>
        <displayformat></displayformat>
      </column>

      <column>
        <fieldname>HTMLLink</fieldname>
        <caption>Link</caption>
        <visibleindex>1</visibleindex>
        <sortindex>-1</sortindex>
        <groupindex>-1</groupindex>
        <sortorder>0</sortorder>
        <type>hyperlink</type>
        <displayformat></displayformat>
        <hyperlinktextfield>LinkText</hyperlinktextfield>
      </column>
    .
    .
    <fields>
      <field>
        <name>NodeName</name>
        <datatype>xs:string</datatype>
      </field>
      <field>
        <name>HTMLLink</name>
        <datatype>xs:string</datatype>
      </field>
      <field>
        <name>LinkText</name>
        <datatype>xs:string</datatype>
      </field>




Need further help? Contact the Triaster Support team by e-mailing support@triaster.co.uk or by calling us on + 44 (0)870 402 1234.
 
Do you have any feedback or suggestions that you would like to share with Triaster? We would love to hear from you! Please e-mail feedback@triaster.co.uk