Dashboard > Atlassian Plugins > ... > Macros > report-table
  Atlassian Plugins Log In | Sign Up   View a printable version of the current page.  
  report-table

Added by david , last edited by David Peterson on Mar 05, 2008  (view change)
Labels: 

{report-table}

Plugin: Reporting Plugin

Displays the each of the items from a reporter in a table.

Description

A report table must contain two things:

  1. A reporter macro (such as content-reporter or user-reporter), which finds the list of items to report on, and
  2. one or more report-columns must be present to define what data is displayed.

It may also optionally include a report-empty macro, which specifies what will be displayed if no items are returned from the reporter.

Usage

{report-table}

{xxx-reporter}

{report-column:title=Key 1}{report-info:item:key 1}{report-column}
{report-column:title=Key 2}{report-info:item:key 2}{report-column}

{report-empty}This is displayed if no results are returned by the reporter.{report-empty}

{report-table}

Parameters

Name Required Default Description
maxResults
all
The maximum number of results to display.
firstResult
1
(Since 2.0.0) Specify the number of the first result to start displaying in the report. The first item has a number of 1.
name
Parameter description goes here.
class
The CSS class to render the table with.
displayTitles
true
If set to false, the title header row will not be displayed. (Since Reporting 1.0.1)
depth
0
If the item has children, the depth do display its descendents. May be 'all' for all descendents, or a whole number value above 0. (Since Reporting 1.3)

Recipes

See Also

I'm trying to report on a table on another page.  I have input this code but I am not getting any data back.  Any ideas why?

{report-table:TopIssues|maxresults=3}
{local-reporter:content:children|label=issues}
{local-reporter}
{report-on:data:Issues}
{report-column:ID}{align:center}{report-info:data:IssueID}{align}{report-column}
{report-column:Description}{report-info:data:Description}{report-column}
{report-column:Severity}{align:center}{report-info:data:Severity|render=wiki}{align}{report-column}
{report-column:Owner}{align:center}{report-info:data:Owner}{align}{report-column}
{report-on}
{report-table}

I'm not exactly sure if you're wanting to create a report on a table in a single other page or on a set of other pages. I'm going to assume it's one table from one page for the moment. Try this:

{report-table:maxresults=3}

{local-reporter:data:Issues|source=Other Page Name}
{local-reporter}

{report-column:title=ID}{align:center}{report-info:data:IssueID}{align}{report-column}
{report-column:title=Description}{report-info:data:Description}{report-column}
{report-column:title=Severity}{align:center}{report-info:data:Severity|render=wiki}{align}{report-column}
{report-column:title=Owner}{align:center}{report-info:data:Owner}{align}{report-column}

{report-table}

If you want to sort the table based on a data value in the table, just add a sort macro (eg. text-sort, number-sort) inside the local-reporter.

David

Thanks - the complication is that I'm creating a template and the source page name is variable.I have managed to get it to work using replace-and-render as follows:

{replace-and-render}
{replace-body}
{report-table:TopIssues|maxresults=3}
{local-reporter:data:Issues|source=%IssuesPage%}
{local-reporter}
{report-column:title=ID}{align:center}{report-info:data:IssueID}{align}{report-column}
{report-column:title=Description}{report-info:data:Description}{report-column}
{report-column:title=Severity}{align:center}{report-info:data:Severity|render=wiki}{align}{report-column}
{report-column:title=Owner}{align:center}{report-info:data:Owner}{align}{report-column}
{report-table}
{replace-body}
{replace-item:%IssuesPage%}Issues for {report-info:content:title}{replace-item}
{replace-and-render}

David, I have this:

{replace-and-render}
{replace-body}
{report-table:TopIssues|maxresults=3}
{local-reporter:data:Issues|source=%IssuesPage%}
{text-filter:data:Status|include=Open}
{text-sort:data:Severity}
{local-reporter}
{report-column:title=ID}{align:center}{report-info:data:IssueID}{align}{report-column}
{report-column:title=Description}{report-info:data:Description}{report-column}
{report-column:title=Severity}{align:center}{report-info:data:Severity|render=wiki}{align}{report-column}
{report-column:title=Owner}{align:center}{report-info:data:Owner}{align}{report-column}
{report-table}
{replace-body}
{replace-item:%IssuesPage%}Issues for {report-info:content:title}{replace-item}
{replace-and-render}

 The text-filter works fine but I get an error as follows with the text-sort:

which is a bit strange as it is in a reporter macro.

Any ideas?

Jon 

I've resolved this now - the Severity field was a list option, so I've got it to work using the following:

{replace-and-render}
{replace-body}
{report-table:TopIssues|maxresults=3}
{local-reporter:data:Issues|source=%IssuesPage%}
{text-filter:data:Status|include=Open}
{text-sort:data:Severity > reference:value|order=ascending}
{local-reporter}
{report-column:title=ID}{align:center}{report-info:data:IssueID}{align}{report-column}
{report-column:title=Description}{report-info:data:Description}{report-column}
{report-column:title=Severity}{align:center}{report-info:data:Severity|render=wiki}{align}{report-column}
{report-column:title=Owner}{align:center}{report-info:data:Owner}{align}{report-column}
{report-empty}No issues to report.{report-empty}
{report-table}
{replace-body}
{replace-item:%IssuesPage%}Issues for {report-info:content:title}{replace-item}
{replace-and-render}
Copyright(c) CustomWare Asia Pacific Pty Ltd
Powered by Atlassian Confluence 2.7.3, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators