Customizing Data Tables and Statistics
- David Goldstein
Overview
By adding a Dataplane Customizer Script to your report, you can modify the presentation and behavior of the data tables and summary statistics shown in report results.
If you're not yet familiar with using Customizer Scripts in your reports, read through Customizing Reports with Scripts for some background and then return back here to get going.
Customizing Data Tables
Using a Customizer Script you can specify the default sort order within the data table shown on the Data tab of report results. This same setting also sets the table sort order within PDF, Excel and CSV report exports.
To customize the sort of these data tables, use the sort
keyword followed by the name of the column to be sorted in quotation marks. You can specify multiple sorts to force secondary sorting after the first specified sort.
For example, to sort a report first by descending priority and then by ascending status, the following customizer script can be used:
customizeTable { sort "Priority" order "desc" // sorts by descending Priority sort "Status" // sorts by the Status column in ascending order }
Sorts can also be listed all on the same line for brevity. The following script is treated identically to the previous example:
customizeTable { sort "Priority" order "desc" sort "Status" }
Note that the column named using the sort
 keyword must already exist on the Data tab of the report output. For example, a report table that contains only the columns "Month" and "# of Issues" cannot be sorted by Priority.
To sort such a report by Priority, go back to the report configuration page, add a Priority segmentation to the Segment By field, and then modify your Customizer Script to refer to this new "Priority" column.
Customizing Statistics
At the top of most reports, Dataplane displays a set of statistics based on the underlying data, such as shown in the following report:
Each of the individual statistics sections can be shown or hidden, renamed, or can have the statistic itself displayed in a custom format.
The following statistics can be manipulated through the Customizer Script:
Statistic Name | Description |
---|---|
total | The "Total Issues" statistic, which displays the total number of issues (or the sum of the values, for numeric reports). |
ave | The "Average Issues" statistic (or the overall average in numeric reports). |
min | The "Min Issues" statistic (or the minimum value in numeric reports). |
max | The "Max Issues" statistic (or the maximum value in numeric reports). |
Â
All statistics are customized in a customizeRender
section in the Customizer Script, using the stat
command followed by one of the statistics names from the table above.
For example, to hide the "Total Issues" statistic from a report, use the following customizer script:
customizeRender { stat "total" show false }
In addition to hiding a statistic, you can also re-title the statistic using the title
keyword. For example:
customizeRender { stat "min" title "Smallest # of Issues" }
To display the statistic value in a different format, use the format
keyword.
The format
keyword uses a standard, Java-based format string to define how to display the statistic. Although many more complicated transformations can be performed, in general, the characters "%f
" will be replaced with the value of the statistic.
For example, if a Sum Numeric Field Report is used to sum a field that contains a quantity of US Dollars, you could use the format
keyword to display the value in a more clear currency notation, such as:
customizeRender { stat "total" format "USD %f" }
Certain characters in the format string, such as the $ sign, need to be escaped with a "\" character.
For example, to display all statistics with dollar signs in front:
customizeRender { stat "total" format "\$%f" stat "min" format "\$%f" stat "max" format "\$%f" stat "ave" format "\$%f" }
If we want to customize the statistic further so that dollars are displayed with the "," character separating groups of thousands and two digits to display cents, we can use the following:
customizeRender { stat "total" format "\$%,.02f" stat "min" format "\$%,.02f" stat "max" format "\$%,.02f" stat "ave" format "\$%,.02f" }
The display format string supports many other options for advanced users; see the Java String format documentation for more details.
Page Contents