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

Added by david , last edited by David Peterson on Feb 27, 2007  (view change)
Labels: 

{report-info}

Plugin: Reporting Plugin

This macro outputs specific information about an item being reported on.

Description

When used in a report, it will report on the current item. When used outside a report, it will report on the current page by default, or the content referred to by the source parameter.

It can handle regular text, dates, numbers, booleans (true/false) and lists, as well as any other object who has a default value specified in a Supplier.

Usage

{report-info:[key=][key chain]|format=[date/number format]|render=[none/wiki]|default=[default value]}

OR

{report-info:[key=][prefix:]value key|format=[date/number format]|render=[none/wiki]}default value{report-info}

Parameters

Name Required Default Description
key/[default]
The key chain to retrieve for the item. A key chain is a list of "prefix:key" values separated by ">" characters. Eg:
content:creator > user:name

See the Suppliers page for more details on what options are available.

format
The date (eg. 'dd MMM, yyyy') or number (eg. '#,##0.00') format to display the item in. This will only be used if the data is a date or a number, respectively. Otherwise, it will be ignored.
source
@self
The source to retrieve information for. By default, this will be the current report item if in a report, or the current page if not in a report. May be '@self' (the current page) or a link to other content (eg. 'SPACEKEY:Page Name', '^attachment.ext').
link
false
If set to 'true' and the current item/key has a URL link, the text generated will be linked to that URL.
render
none
If set to 'wiki', the generated text will be rendered as wiki text. Otherwise, it will be output as written.
default
The contents of this parameter will be used if the item/key is empty. It will be rendered as wiki text. Alternately, the body of the macro can also be used, if more complex wiki text is required.
separator
comma
The type of separator to display between each item, if the key value pointed to is a collection of other items. May be one of the following:
  • bracket - Square brackets ('[', ']') surrounding each item.
  • brace - Braces ('{', '}') surrounding each item.
  • comma - A comma (',') between each item.
  • paren - Parentheses ('(', ')') surrounding each item.
  • pipe - A pipe ('|') between each item.
  • newline - A line break after each item.
  • "custom" - Any other character you wish, specified between quotes.

Recipes

See Also

Hello David,

I am using the following code to generate a news list, but when using the summary option for content display, the code cuts out the first few words if body text starts with the letter t, we are getting this issue on two installs and I have tried everything to do a work around but no luck, can you please let me know of a work around to display summary contents instead of the full body of the news item without the truncation issue.

Thanks a lot,

{report-block:maxResults=5}

  {content-reporter:type=news}
    {date-sort:content:modification date\|order=descending}
  {content-reporter}
               
  {report-body}
                
  h2. {report-info:content:title\|link=true}

  By {report-info:content:modifier\|link=true} on {report-info:content:modification date\|format=dd MMM @ h:mm a\|link=true} - {report-info:content:all comments > collection:size\|link=true} comments \\
  Keywords: {report-info:content:labels\|link=true\|default=_none_}
                {homep}
  {report-info:content:summary\|render=wiki}
                {homep}
  {report-body}

  {report-empty}
  _No news items are available.\_
  {report-empty}

  {report-block}

PS: Reporting plugin rocks, its the best plugin for confluence, one can do a PHD in working with reporting plugin

Hi Imran,

The 'content:summary' value does one of two things:

1. If an excerpt has been set, displays the excerpt.
2. Otherwise, it uses the 'ContentEntityObject.getExcerpt()' method, which actually returns the search excerpt. However, because it's for search, it drops small words like 'the', 'is', 'then', etc, which is why the first few words of sentences are often truncated.

As an alternative, you could use this instead:

{report-info:content:body > first 100}|render=wiki}

You can substitute whatever number you like there for '100' of course. The risk is that it will cut your wiki markup in half somewhere, so you'll end up with some odd rendering at the end of the summary.

Hope that helps...

PS: Yeah, it did end up getting tricky. Let me know if you write any academic papers on it - particularly if they have cool diagrams

Hi.

I'm extremely new to Confluence (about a week) and the reporting plug-in has been very helpful so far.  I am trying to reproduce the "recently-updated" macro using the reporting plug because I'm running into problems with having multiple on the same page. I don't necessarily need the "view more" feature.

Any hints on how to add style/html tags would be greatly appreciated. Also displaying the space name for each line item seems to be aluding me.

Here's the code I've been using because I'm putting this directly into the layout:

 $helper.renderConfluenceMacro("{report-list:maxResults=20}{content-reporter:spaces=@all|type=news}{date-sort:content:modification date|order=descending}{content-reporter}{report-body}{report-info:content:title|link=true} span. {report-info:content:modifier|link=true} ({report-info:content:modification date|format=dd MMM, yyyy}) {report-body}{report-empty}_No news items are available._{report-empty}{report-list}")

The span. becomes output text instead of an HTML tag. 

Thanks,

Cara 

The wiki renderer converts HTML characters like "<" and ">" so that they are output directly. To mix them in, you will probably want to use the {span} macro from Adaptavist's 'Content Formatting Macros' instead.

Thanks David. The Content Formatting Macro did wonders for me. I've gotten very close to replicating the layout that I need.

One piece seems to be missing. For each item displayed, I'd like to include the space that it is associated with:

{report-block:maxResults=10}
 
{content-reporter:spaces=@all|type=news}
{date-sort:content:modification date|order=descending}
{content-reporter}
 
{report-body}
{tr}{td}
{div:class=smalltext|style=float:right}
	 by {report-info:content:modifier|link=true} ({report-info:content:modification date|format=dd MMM, yyyy})
{div}
{report-image:content:icon} {report-info:content:title|link=true} {span:class=smalltext}({report-info:space:title}){span}
{td}{tr}
{report-body}
 
{report-empty}{tr}{td}No news items are available.{td}{tr}{report-empty}
 
{report-block}

I end up with empty parenthesizes. I'm assuming I've missed something obvious. Is report-info:space:title not the right macro to use or can it not be used in the context I've described?

Thanks,
Cara 

Try 'space:name' instead. I should probably add 'space:title' as a synonym for consistency with 'content:title'. It was based on the API name for the value, which is Space.getName(), but that's not really a terribly good reason

View the rest of this thread  |  2 more comments by 2 persons

Hi David,

I have a problem to get the following report running as intended:

{report-block}
  {local-reporter:content:children|type=page}
    {expand-on:data:contentCategory|as=category}
      {text-sort:item:key|order=ascending}
    {expand-on}
  {local-reporter}

  {repeat-filter:expanded:category}
  {report-body}
    h2.{report-info:expanded:category}
  {report-body}

  {report-body}
    {report-info:content:title|link=true}; {report-info:data:PaperTitle}; {report-info:data:authorLastname}, {report-info:data:authorFirstname}
  {report-body}

  {report-empty}This report has no items.{report-empty}
{report-block}

The report is on some conference papers, each represented by a confluence page and related to one or
more content categories. The report should list for all categories all papers that are listed to a category.
A paper will appear in the report several times if it is assigned to more than one category.
Categories are assigned to a paper through a list-data macro with 'multiple=true'.

The report shows all categories assigned to at least one paper. For each paper assigned to a category
the report outputs one row only with the seperators between the 'report-info' macros. That means,
'report-info' is not working in this context.

What is the problem? We are running Confluence 2.6.2, Reporting Plugin 2.1.1 and Java 1.4.2.

Kind regards

Günter

I'm not sure you will be able to get it working as you expect with the current configuration. The {repeat-filter} will not be working quite right here, since it only filters out repeats which are immediately after each other. In your case, they could be in any order.

If you want to be able to group by category, I would suggest a slightly different structure. Firstly, make the category options into Pages, all under a 'Categories' page. Eg:

  • Categories
    • Category A
    • Category B
    • Category C

Then, in your Paper pages, use this for your 'contentCategory' list:

{list-data:contentCategory}
  {content-options:parent=Categories}
{list-data}

The advantage of this is that you can get your list of categories as a group you can report on. Then, your report would look like this:

{report-block}
{local-reporter:content:children|source=Categories}
  {text-sort:content:title}
{local-reporter}

{report-body}
  h2. {report-info:content:title}

  {report-block-1}
    {local-reporter:content:children|source=Papers}
      {collection-filter:data:contentCategory|matchItems=any}
        {content-filter:reference:value|scope=@self}
      {collection-filter}
      {text-sort:content:title}
    {local-reporter}
    {report-body-1}
      {report-info:content:title|link=true}; {report-info:data:PaperTitle}; {report-info:data:authorLastname}, {report-info:data:authorFirstname}
    {report-body-1}
  {report-body}

  {report-block-1}
{report-body}

{report-block}

In summary, this will iterate through the categories, output the category title as a heading, then iterate through all papers, displaying any which have the current category selected. To add new categories, just add a new child page under 'Categories'.

David, thank you for your fast response. I thought the text-sort in the expand-on clause would give me the required order.
Looking in the text-sort description I found your hint that it will not. I tried your solution and received the following message:

Error formatting macro: local-reporter: java.lang.NoClassDefFoundError: com/atlassian/confluence/links/AbstractAttachmentLink
text-sort: This macro must be used in a sortable location, such as a reporter macro.

I had that already several weeks before. It's the problem, that Confluence 2.6.2 does not support the source attribute
of the reporting macros.
Could there be another way to solve the problem?

Kind regards

Günter

Unfortunately there isn't a version of Reporting that is 100% compatible with 2.6. The only real solution is to upgrade to 2.7...

Copyright(c) CustomWare Asia Pacific Pty Ltd
Powered by Atlassian Confluence 2.7.3, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators