SummaryTableWriter - Global

  • Rversion finale: Australia
  • Mis à jour 12 mars 2026
  • 2 minutes de lecture
  • The SummaryTableWriter script include enables the creation of summary sets for reports that can be generated with standard queries and trending.

    This script include provides methods that enable you to customize the output of the summary sets for reports, such as adding a title, defining a query on which to base the report data, and specifying the stack column and X axis.

    SummaryTableWriter - SummaryTableWriter(String tableName, String columnName)

    Produces a summary set for the COUNT of all incidents grouped by category.

    The custom chart definition table contains a field named Table that is hidden by default. If the field is set, which it is in some of the base custom charts, then, no matter what is defined within the custom chart scripts, clicking on the chart points you to this table.

    For example, if you create a custom chart against the [task] table through a script, but you copied the custom chart from a custom chart that contains Table = incident, then clicking on any bar in the custom script will go to incident.do rather than to task.do.

    To check the value of the Table field, click the additional actions icon and select Configure > Form Layout and move the Table field from Available to Selected. Open the custom chart definition and set the Table field to none.

    Tableau 1. Parameters
    Name Type Description
    tableName String

    Table used in the query to generate the data.

    columnName String Field that is used to determine the X axis values.
    var summarySet = new SummaryTableWriter('incident', 'category');
    summarySet.generate();

    SummaryTableWriter - generate()

    Creates the summary set of records for reports.

    Tableau 2. Parameters
    Name Type Description
    None
    Tableau 3. Returns
    Type Description
    void
    var opened = new SummaryTableWriter('incident', '');
    opened.generate();

    SummaryTableWriter - setQuery(String query)

    Defines the query to use to load the data for the summary record set.

    Tableau 4. Parameters
    Name Type Description
    query String Query to use to load the summary data.
    Tableau 5. Returns
    Type Description
    void
    var summarySet = new SummaryTableWriter('incident', 'category');
    summarySet.setQuery("active=true");
    summarySet.generate();

    SummaryTableWriter - setStackOn(String column)

    Defines the column on which to stack the incident records.

    Tableau 6. Parameters
    Name Type Description
    column String Column that is used to stack the incident records.
    Tableau 7. Returns
    Type Description
    void
    var summarySet = new SummaryTableWriter('incident', 'category');
    summarySet.setQuery("active=true");
    summarySet.setStackOn('priority');
    summarySet.generate();

    SummaryTableWriter - setTitle(String title)

    Sets the title of the summary set, which is also the chart title.

    Tableau 8. Parameters
    Name Type Description
    title String Title given to the summary set that is used as the chart title. Also used as the key field for chart generators to determine whether the data was generated.
    Tableau 9. Returns
    Type Description
    void
    var opened = new SummaryTableWriter('incident', '');
    opened.setTitle("Trend of Open Incidents");
    opened.setTrend('opened_at', 'month');
    opened.generate();

    SummaryTableWriter - setTrend(String field, String interval)

    Sets the time field used for the X axis or stacking field; can also set the time interval used to calculate the trend.

    Tableau 10. Parameters
    Name Type Description
    field String Time field that is used for X axis values if grouping is not used. If grouping is used, then this is the stacking field.
    interval String Time interval that is used to calculate the trend.
    Tableau 11. Returns
    Type Description
    void
    var opened = new SummaryTableWriter('incident', '');
    opened.setTitle("Trend of Open Incidents");
    opened.setTrend('opened_at', 'month');
    opened.generate();