Dashboard > Atlassian Plugins > ... > Suppliers > Scaffold Data Supplier
  Atlassian Plugins Log In | Sign Up   View a printable version of the current page.  
  Scaffold Data Supplier

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

Summary

Provides access to data set using Scaffolding Data macros.

These keys case-sensitive. You must provide the same key as was used to save the data.

Details

Name: Scaffold Data Supplier
Prefix: data (required)
Supported Content: Confluence content.
Provided By: Scaffolding Plugin

Keys Supported

The following are the list of keys which this supplier will return a value for.

Key Content Types Return Type Description
[Scaffold Data Name] Confluence content. anything Returns the value stored for the specified Scaffolding data value. May be any type supported by Scaffolding, including Text, Numbers, or References, to name a few. If a data field is inside another group, it can be specified by putting a period (".") between the field names (eg. "Group.Field Name").

Related Recipes

Include all child pages recipe, Space list recipe

Examples

Simple Data

Set up a page called 'Test Page' with some simple Scaffolding data on it like this:

*Text:* {text-data:Text}{text-data}
*Number:* {number-data:Number}
*Date:* {date-data:Date|format=dd MMM, yyyy}

Then, using a table report, you could display all pages containing the specified scaffolding data like this:

{report-table}

{content-reporter}

{report-column:title=Text}{report-info:data:Text}{report-column}
{report-column:title=Number}{report-info:data:Number|format=#,##0.00}{report-column}
{report-column:title=Date}{report-info:data:Date|format=dd-MM-yyyy}{report-column}

{report-table}

Hi, 

I've a

{table-data:Tablename}
and wanted to access to a
{text-data:Blabla}
which is inside the table.

But neither

{report-column:title=Test1}{report-info:data:Blabla}{report-column}
nor
{report-column:title=Test2}{report-info:data:Tablename.Blabla}{report-column}
shows the text-data:Blabla value

What am I doing wrong?

Cheers, Robert 

Hi Robert,

table-data contains multiple rows of data, so you need to treat it like a list. As such, you should use something like this:

{report-column:title=Test 3}{report-on:data:Tablename}{report-info:Blabla}{report-on}{report-column}

Hi David,

thanks for your answer. Now I've access to the data. But the problem is, that i got the values of all columns, if I have a table with more than one row.

Is it possible to get the value of only one row, whose other column value matches something.

For example I've an adress list created with scaffolding's table-data. Now I wanted to display the phone number from the person whose surname is "Peterson"  

Only if you do a sub-report. Eg:

{report-column:title=Test 3}
  {report-block}
    {local-reporter:data:Tablename}
      {text-filter:map:Surname|include=Peterson}
    {local-reporter}
    {report-body}{report-info:map:Blabla}{report-body}
  {report-block}
{report-column}

Of course, this will only work to one level, due to Confluence's non-nested-macro parser.

Great! You're the man, David!

Thank you so much, for your very fast support!

One question is still remaining (Then I'm happy and have a nice evening!): How can I hide the empty rows in my report-table?

Cheers,

Robert 

Can't help you there, unless you can find a way to filter them out in the reporter section. What that might look like would depend on your data. Feel free to raise a feature request - be specific about examples of where this would be useful.

Hi

I'm having trouble reporting on table-data. I can report on the data but the multiple entries for each row appear next to each other rather than on a new line:

My scaffolding code:

{table-data:status-core-team} || _Name_ || _Company_ || _Phone_|| _Email_ ||
| {text-data:status-core-team-name} | {text-data:status-core-team-company} | {text-data:status-core-team-phone} | {text-data:status-core-team-email} | {table-data}

My reporting code:

{report-table}
{content-reporter:spaces=@global|type=page|labels=status-page}
{content-reporter}
{report-column:title=City/Town}{report-info:content:title|link=true}{report-column}
{report-column:title=Name}{report-on:data:status-core-team}{report-info:data:status-core-team-name|separator=comma}{report-on}{report-column}
{report-column:title=Company}{report-on:data:status-core-team}{report-info:data:status-core-team-company|separator=comma}{report-on}{report-column}
{report-table}

Results in:

City/Town Name Company
Singapore JoeNancyBill Coy1Coy2Coy3
Auckland Danny Coy7
Shanghai ZingYang Coy4Coy5

I was hoping for:

City/Town Name Company
Singapore Joe Coy1
Singapore Nancy Coy2
Singapore Bill Coy3
Auckland Danny Coy7
Shanghai Zing Coy4
Shanghai Yang Coy5

What am I doing wrong?
TIA, Tomi

What you want here is the expand-on macro in your reporter. Eg:

{report-table}
{content-reporter:spaces=@global|type=page|labels=status-page}
  {expand-on:data:status-core-team|as=team}
{content-reporter}
{report-column:title=City/Town}{report-info:expanded:item > content:title|link=true}{report-column}
{report-column:title=Name}{report-info:expanded:team > data:status-core-team-name}{report-column}
{report-column:title=Company}{report-info:expanded:team > data:status-core-team-company}{report-column}
{report-table}

Also, as a general tip. you don't need to have the 'status-core-team-' prefix in front of your values inside your table-data. They can simply be 'name', 'company', 'phone', etc. Makes it much easier to read/type.

Thanks David, that worked a treat.
Is there any way to nominate some of the table-data "fields" to render as wiki?

I unsuccessfully tried the following:

{report-column:title=Name}{report-info:expanded:team > data:status-core-team-name|render=wiki}{report-column}

TIA, Tomi

I assume you're trying to have the name rendered as a link to the user's profile? Simply adding 'render=wiki' won't work here since you would need to have the name in the standard wiki link format (ie [~username]). There are two options:

1. Use a list-data and user-options combo to allow selection of specific users. If that is done, render=wiki should work fine.
2. Assuming the 'name' value is a username, use the 'Replace and Render' macros. It's a bit more painful, but would look something like this:

{replace-and-render}
{replace-item:%username%}{report-info:expanded:team > data:status-core-team-name}{replace-item}
{replace-body}[~%username%]{replace-body}
{replace-and-render}

Not sure if either solution will work in your case though...

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

Hi, what is the best way to determine if a data item is defined or not on a page?  I have been trying varieties of "space:homepage > data:Project_Status>text:size" to no avail.  I would like to put the outcome in a boolean-filter.

Thanks  Nick

Most of the type-specific filters (eg text-filter) have a 'required' parameter, which will test if the value is present. Eg, to require that a value is present, use:

{text-filter:space:homepage > data:Project_Status|required=true}

If you want to specify that it must not be set, set required=false.

how can I list metadata as defined on pages using the metadata v2 plugin? I think it used to work as follows, but now the columns just come up blank.

{report-table}

{content-reporter:parent=My Page|label=test}
{content-reporter}

  {report-column:title=Title}{report-info:content:title|link=true}{report-column}
  {report-column:title=Project}{report-info:content:item > data:Project}{report-column}
  {report-column:title=Project2}{report-info:content:Project2}{report-column}
  {report-column:title=Project3}{report-info:data:Project3}{report-column}
  {report-column:title=Project4}{report-info:content:item > Project4}{report-column}
  {report-column:title=Misc}
    *{report-info:content:title}* ({report-info:content:modification date|format=dd MMM, yyyy} by {report-info:content:modifier|link=true})
  {report-column}

{report-table}

Hi James,

For starters I would recommend using the local-reporter instead of content-reporter for performance reasons. Secondly, I'm not sure what the 'content:item' entries you have there are. Essentially, you need to have all metadata values prefixed with 'data:'. That said, I haven't tested this with Metadata 2, and it's possible that Andy has changed his storage mechanism in that version. But try something like this instead:

{report-table}

{local-reporter:content:children|source=My Page}
  {content-filter:@self|label=test}
{local-reporter}

  {report-column:title=Title}{report-info:content:title|link=true}{report-column}
  {report-column:title=Project}{report-info:data:Project}{report-column}
  {report-column:title=Project2}{report-info:data:Project2}{report-column}
  {report-column:title=Project3}{report-info:data:Project3}{report-column}
  {report-column:title=Project4}{report-info:data:Project4}{report-column}
  {report-column:title=Misc}
    *{report-info:content:title}* ({report-info:content:modification date|format=dd MMM, yyyy} by {report-info:content:modifier|link=true})
  {report-column}

{report-table}

This assumes that you have metadata called 'ProjectX' at the top-level of each page.



Updated by David Peterson
May 22, 2008 06:57
  • the various content:item were attempts at guessing at a syntax
  • what you show doesn't work for me with metadata v2. The "Project" column is empty.
{report-table}

{local-reporter:content:children|source=My Page}
  {content-filter:@self|label=test}
{local-reporter}

  {report-column:title=Title}{report-info:content:title|link=true}{report-column}
  {report-column:title=Project}{report-info:data:Project}{report-column}
  {report-column:title=Misc}
    *{report-info:content:title}* ({report-info:content:modification date|format=dd MMM, yyyy} by {report-info:content:modifier|link=true})
  {report-column}

{report-table}

As I said earlier, I don't know what has changed. However, you should be able to use whatever mechanism Metadata has for outputting values anyway - {metadata-from} or whatever it is. Try using that instead of the {report-info} macro for Metadata values.

ah. that works for populating the column. Any similar tricks for the {text-filter} part?

{local-reporter:content:children|source=reporting plugin and metadata}
  {content-filter:@self|label=test}
  {text-filter:data:Project|exclude=.*1.*}
{local-reporter}

I'm using the metadata2 plugin to put metadata items into various pages, and I'd like to iterate over the collection and display the meta-item name and its value without having to specify each item individually (data:item1 etc)... as the meta items are not always the same on each page. Is this possible?

thx, Nick

Unfortunately not. Metadata simply stores each data item directly as an individual Content property, and doesn't keep a list of names anywhere. As such, there's no way to get such a list of names from Metadata. If the data had/has been stored via Scaffolding, however, it's theoretically possible, but there isn't any hook to get to the root data set currently implemented. If there was, you coulduse the Map Supplier to iterate through them, along the lines of:

{report-table}
{local-reporter:data:@all}
  {text-sort:entry:key}
{local-reporter}

{report-column:title=Key}{report-info:entry:key}{report-column}
{report-column:title=Value}{report-info:entry:value}{report-column}

{report-empty}_No entries are available._{report-empty}

{report-table}

Currently the 'data:@all' function doesn't actually exist, however. If it would be useful, go ahead and create a feature request for it.

Nick, I haven't been able to get the metadata from the metadataV2 plugin to show up in the reporting plugin at all, even if I specify the names directly. Have you been able to get that to work? If so, would you point me to an example, and the details (plugin version for the relevant plugins, confluence version etc).

I'm trying to access scaffold data in a report without much success. I'm mixing metadata with scaffold data, and am using live-templates. Here is my example:

Child Page Content
Owner: {metadata:Owner}Owner Metadata{metadata}
{live-template:Owner Response}
Owner Response (template)
{scaffold:pm_response}
Status: {list-data:Status}
{list-option:No}No{list-option}
{list-option:Yes}Yes{list-option}
{list-data}
Complete{data-list}
Comments: {text-data:Comments}{text-data}
{scaffold}
Report Code (on parent page)
{report-table}
{content-reporter:spaces=@self|type=page|scope=@self > descendents}
{content-reporter}
{report-column:title=Page}{report-info:content:title|link=true} {report-column}
{report-column:title=Owner}{report-info:data:Owner}{report-column}
{report-column:title=Status}{report-info:data:Status}{report-column}
{report-column:title=Comments}{report-info:data:Comments}{report-column}
{report-empty}There are instances of this report!{report-empty}
{report-table}


Output
Page Owner Status Comments
link_to_child_page Owner Metadata

After the "owner" updates the page and inputs scaffold data, the 'status' and 'comments' continue to be blank, however the Metadata 'owner' shows up in the report.

Hmm. Not sure exactly what the problem would be, other than potenitally mixing Metadata and Scaffolding (not a recommended practice). The markup looks correct as far as I can tell. Have you tried a page which doesn't have any Metadata on it? Does it make any difference?

I've discovered that using {report-on} helps sometimes. For example:

{report-table}
{content-reporter:spaces=@self|type=page|scope=@self > descendents}
{content-reporter}
{report-column:title=Page}{report-info:content:title|link=true} {report-column}
{report-column:title=Owner}{report-info:data:Owner}{report-column}
{report-column:title=Status}{report-on:data:pm_response}{report-info:data:Status}{report-on}{report-column}
{report-column:title=Comments}{report-on:data:pm_response}{report-info:data:Comments}{report-on}{report-column}
{report-empty}There are instances of this report!{report-empty}
{report-table}

Results in:

Page Owner Status Comments
child_page1 Owner 1    
    Complete Comment2

If scaffold data does not exist, then the metadata data is displayed. Otherwise, only the scaffold data is displayed. Thoughts? Should I try using {expand-on}?

{expand-on} produces the following error:

...expand.ExpansionException: Unsupported expand-on value: data:pm_response = 
{Status=Commplete, Comments=Comment2}
View the rest of this thread  |  3 more comments by 2 persons

And, based on the fact that {report-on} is able to display values, how would I do a text-filter based on accessing this data? For example, I have a "Yes"/"No" option for whether or not a project was canceled. I'd like to have one report for all canceled projects, and another for all not canceled ones. But the following filter doesn't seem to work:

Does not actually exclude pages with canceled=Yes
{content-reporter:spaces=@self|type=page|scope=@self > descendents}
{report-on:data:pm_response}{text-filter:data:canceled|exclude=.*Yes.*}{report-on}
{content-reporter}
Does not actually ixclude pages with canceled=Yes
{content-reporter:spaces=@self|type=page|scope=@self > descendents}
{report-on:data:pm_response}{text-filter:data:canceled|include=.*Yes.*}{report-on}
{content-reporter}

hi,

Using scaffolding and reporting plugin, I set a data like below

{set-data:subsEmailUserGroup}{report-on:data:RecipientsSurvey|separator=comma}{report-info:reference:value > user:email}{report-on}{set-data}

I try to get the content of the data with the report-on macro, in order to use it as a macro parameter like below.

{report-on:injected=true|render=wiki}{mymacro:param1=%data:subsEmailUserGroup%}{report-on}

But I get this javascript error : Error formatting macro: report-on: java.util.EmptyStackException

I have to use Scaffolding 2.7-dr9, and Reporting 2.1.1, with Confluence 2.8.1

I wouldn't really recommend mixing Scaffolding and reporting in this fashion. set-data only stores its contents at certain times, and renders them at different times. This means that you may not be getting what you expect in the second report-on...

You might try something like the Replace and Render plugin from Adaptavist to get around this. Eg:

{replace-and-render}
{replace-item:%subsEmailUserGroup%}{report-on:data:RecipientsSurvey|separator=comma}{report-info:reference:value > user:email}{report-on}{replace-item}
{replace-body}{mymacro:param1=%subsEmailUserGroup%}{replace-body}
{replace-and-render}

Otherwise, could you please create a bug report with the above details, plus the stack trace from you web server with the details of the 'EmptyStackException'. Thanks.

Thanks a lot for the answer.

I'm going to convince my IT service to use the Replace and render plugin

I would like to capture the name of the person for whom a request is for. Sometimes this is the request creator (e.g. {report-info:content:creator}), but sometimes it is submitted for someone else. I'd like to use the creator as the default name, but allow the requester to change it. I tried:

{text-data:requester|width=350px}{report-info:content:creator}{text-data}

But this puts {report-info:content:creator} into the text field, rather than rendering the macro and putting the user's name in the text field. Any thoughts on how I can accomplish this?

This might be related to your comment above about not mixing Scaffold & reporting.  I tried using {page-info:created-user}, but get the same result (e.g. the text box has the macro, not the rendered macro, as its content.

Using {report-info:content:creator} would work, in that when it's saved, the creator name will be displayed. {text-data} lets you enter wiki markup...

However, to achieve the effect you're after, try this:

{report-on:injected=true}{text-data:requester|width=350px}%content:creator%{text-data}{report-on}

Thanks for the reply. This is really close to what I'm trying to achieve. Couple questions:

  1. Is there a way to make the text-data still editable (when I try this, the content creator's ID gets displayed when editing, but it's not in a text box for me to be able to change).
  2. How do I report on the "requester" value? Wrapping it in {report-on} seems to make data:requester not work anymore.
  3. Is there any way to pull in the content creator's full name rather than their ID (which is what this is currently doing in my environment)?

Hmm. Ok, it seems like the 'injection' is doing something quirky with the rendering process. Try this instead (requires Adaptavist's Replace and Render macro):

{replace-and-render}
{replace-item:%full name%}{report-info:content:creator > user:full name}{replace-item}
{replace-body}{text-data:requester|width=350px}%full name%{text-data}{replace-body}
{replace-and-render}


Updated by Ed Bradburn
Oct 24, 2008 03:21

Hi Folks!

I have a question about retrieving data from Scaffold pages.

Basically, I have an attachment-data macro that adds attachments to pages in a space.

I then want one page to list all of these attachments.

I have looked at Scaffold, Attachment and and co but I cannot decipher what is being said there :=)

I have got as far as this:

report-info:data:en_pdf

(enclosed in a space reporter and table construct)

This gives me the name of the PDF.

So far, so good.

But I would like:

  • A link to the PDF (report-link)
  • The link as an icon (report-image)

However, I don't see how to do this.

Does anyone have any pointers?

Is it possible?

UPDATE: just to expand on the point here, because I think there is a fundamental difference between the Scaffolding + Reporting way of doing it and Metadata 2, which I cannot use (because I cannot use macros + metadata).

If I store the value in metadata, it makes a full link to the attachment in Wiki markup. "Store" means doing this:

{metadata:save_pdf}{attachment-data:blabla}{metadata}

If I access the "blabla" value directly using the Supplier for Reporting, I only get the attachment name.

Since I have no way of linking this name back to the attachment - how do I create a download link?

Any help appreciated!