{get-data}
Plugin: Scaffolding Plugin, from version 2.3-dr5
Displays stored field data. Numbers and dates may be formatted nicely.
Usage
Parameters
| Name |
Required |
Default |
Description |
| [default]/name | | | The name of the field. May be a 'field path' (e.g. 'Group Name.Field Name') |
| default | | | The default value to display (rendered as wiki directly) if the field is not set. Alternately, the default can be set as the body of this macro. |
| name | | | Parameter description goes here. |
| format | | | The number format (e.g. '#,##0.00') or date format (e.g. 'dd MMM yyyy') to use when parsing the value being set. The parameter will be ignored for data types other than 'number' or 'date'. |
| separator | | comma | If the item/key points to a list of results, the type of separator to display between each item. 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.
|
Notes
Unlike report-info, this macro can tell when it is inside a scaffolding table-data or repeating-data macro and will access locally-stored properties within the repeating section.
See Also
I'm having a problem with this macro, and I'm not sure if it's an issue or just my ignorance.
The docs say this macro can tell when it's inside a {repeating-data} section, which is great, but can it also work with data outside of {repeating-data}?
In my project, I have a major version number (1.e. 2.0) that is entered in a {text-data} field. I then want to have an arbitrary number of sections for each minor version number (i.e. 2.0.1, 2.0.2) Using {get-data} to refer to the major version number works fine when I'm outside of the {repeating-data} macro, but fails when I'm inside of it.
Also, what is the "field path" you refer to? I can't find a mention of this term anywhere else in the docs. Could I use this to indicate the "root" level for the field I want?
Hi Jim,
I will be able to provide better guidance if you can provide the wiki markup you're using. Could you please email it to me and we can hopefully resolve it.
David
To answer your other question, the "field path" is only mentioned here because I think this is the only macro which will use it. The Reporting Plugin also makes use of it, actually.
Essentially, if you have a field inside a group-data, repeating-data or table-data, you can access it by putting the name of the 'parent' data field post-fixed by a '.' then the field name. For the latter two you will also have to provide the index of the row you want. For example:
{group-data:Group} *Text:* {text-data:Text} {group-data}This would be accessed by get-data like this from outside the group-data:
{get-data:Group.Text}For repeaters (table-data, repeating-data) you need to add the row index. Eg:
{repeating-data:Repeating} *Text:* {text-data} {repeating-data}You could then access the first row's 'Text' field like this:
{get-data:Repeating.0.Text}This has the downside of you having to know how many rows there are in advance. If you want to create something which automatically adjusts for the full set of data I would suggest using the Reporting Plugin.
Hi
I'm using get-data in a replace-and-render arrangement to feed the value of a date variable into a date-filter, but I am getting an error to say that the date is "unparseable". Is there some special syntax for dates that is needed?
Code used:
{replace-and-render} {replace-body} {local-reporter:data:ManDays|source=Weekly Progress} {date-filter:WeekBeginning|minValue=%CurrentWeek%|maxValue=%CurrentWeek%} {local-reporter} {report-body}{report-info:data:DaysUsed|format=#,##0.0}{report-body}{report-block} {replace-body} {replace-item:%CurrentWeek%}{get-data:StartDate}{replace-item} {replace-and-render}Any ideas?
Thanks
Jon
The default date format will be whatever the default date format is on your particular system. I would recommend specifying the 'format' parameter to match your input values, as described above.
Sorry - to clarify - set the 'format' value for the date-filter macro, so it knows what to expect. Eg:
{date-filter:WeekBeginning|minValue=%CurrentWeek%|maxValue=%CurrentWeek%|format=dd/MM/yyyy}Or whatever you're using...
Thanks David - it works if you use the format parameter in both the get-data and the date-filter.
Hi,
I have very simple dynamic table defined with table-data macro:
{table-data:MyTable} {text-data:Products} default product {text-data} {number-data} 0 {number-data} {table-data}which I'm retrieving with get-data macro on the same page
{get-data:My Table.0.Products} default value {get-data}and everything works fine.
However, if I reference the same page on other page with include macro, data is no longer correctly pulled from the table and I only get default values placed between get-data macro directives.
Any idea what's going on and what might be possible solution?
Version of scaffolding plugin I'm using: 2.6-dr8
Version of Confluence: Confluence v2.8.1.
Thank you
Peter
Well, for starters Confluence 2.8 is unsupported at present. In this case I'm not sure what would be going on, however you could try using report-info instead of get-data. Eg:
{report-info:data:My Table.0.Products}Otherwise, feel free to create a bug report and we'll see if it can be resolved some other way.
David, I couldn't get report-info working either. What's more I couldn't get report-info working on the page which has not even been included via include. report-info is not pulling any data. Looks like it cannot resolve data:My Table ...
{report-table} {local-reporter:data:My Table}{local-reporter} {report-column:title=Products}{report-info:data:Products}{report-column} {report-empty}No data.{report-empty} {report-table}...as it always prints No data, no matter how big is the set of data in My Table.
I've raised a bug SCAFF-233 and haven't raised anything for this issue as I would suspect that it's caused by Scaffolding plugin rather then Reporting.