Scaffolding List Options, Labels in Reporting - How?

Christian Brümmer November 7, 2018

Hello all,

we are using the the plugins Scaffolding and Reporting from Servicerocket - and I'm brand new to it. My first simple task is failing.

On my forms I have a

  List Data|name=Typ with

      List Options:

        List Option|value=1|label=SOAP

        List Option|value=2|label=REST

        List Option|value=3|label=File

        ....

 

And in my report, I want to see the labels instead of the values.

Report Info|data:Typ

I only get the values 1, 2, 3... but I want to see the labels. Is it possible? If yes, please tell me also, where this documented. Or do I have to use Report Blocks with filter for any case?

Thanks in advance

Christian

2 answers

0 votes
Martin Cunningham August 29, 2019

I have developed a solution that's conceptually intuitive (to me) but a bit complex to implement. It's similar to how you might design a simple relational database application - though nowhere near as robust.

In this simplified illustration of the solution, I have three pages: (i) a list of colors - Red, Blue and Yellow, each with its own numeric ID, stored in a Scaffolding data table (ii) a form containing two Scaffolding fields - Name {text-data} and Color {list-data}, and (iii) a report that displays the name and color that are stored in the form. When you select an item from the Color option list, the form stores the ID and looks up and displays the color associated with that ID. Similarly, the report pulls data from the form, then looks up and displays the color associated with the ID stored in the form.

The solution relies on a couple of somewhat advanced features in Reporting: Expanding Reporter and parameter injection. The Expanding Reporter macro extracts the contents of a Scaffolding data table into a collection which you can display in an option list or from which, using filters, you can extract a single element (such as the color associated with id = x). Among other things, parameter injection allows you to use a value generated by one report (e.g., a numeric ID stored in a form) as the key to look up the corresponding value (e.g., the color) within another report.

Here goes:

1. Create a new blank page, title it "Parent", then save it.

2. Create a new blank page directly under "Parent", title it "Colors", save it, re-open it for editing, open the Source Editor (click on "< >"), replace whatever is there with Code Block 1, then save it again.

3. Click "Edit Contents" and enter three rows of data into the table:

| id | color  |
---------------
| 1 | Red |
| 2 | Blue |
| 3 | Yellow |

4. Create a new blank page directly under "Parent", title it "Form", save it, re-open it for editing, open the Source Editor, replace whatever is there with Code Block 2, then save it again.

5. Click "Edit Contents" and enter the following data into the form:

---------------
| name | Bob |
---------------
| color | Red |
---------------

Note that the option list will display the colors Red, Blue and Yellow but will store the selected option (Red) as the value 1. You can verify this by selecting View Scaffolding XML from the menu ("...") in the upper-right corner of the window.

6. Create a new blank page directly under "Parent", title it "Report", save it, re-open it for editing, open the Source Editor, replace whatever is there with Code Block 3, then save it again.

7. If all goes well, the report will look like this:

----------------
| name | color |
---------------
| Bob | Red |
----------------

While it has weaknesses (e.g., no way to enforce unique ID constraint on the lookup table), I find this approach preferable to embedding a bunch of {option-data} macros in my form code. It also seems to address the problem you were trying to solve, which is what I was initially trying to do when I came up with it. Hope it helps.

Code Block 1

<ac:structured-macro ac:macro-id="7297d773-440c-4bec-9aef-67eab8f88eee" ac:name="table-data" ac:schema-version="1">
<ac:parameter ac:name="name">t_colors</ac:parameter>
<ac:rich-text-body>
<table class="wrapped">
<colgroup>
<col/>
<col/>
</colgroup>
<tbody>
<tr>
<th>number</th>
<th>color</th>
</tr>
<tr>
<td>
<div class="content-wrapper">
<ac:structured-macro ac:macro-id="81cbd892-87d9-437a-9980-8f83eda7988d" ac:name="number-data" ac:schema-version="1">
<ac:parameter ac:name="name">id</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
</ac:structured-macro>
</div>
</td>
<td>
<div class="content-wrapper">
<ac:structured-macro ac:macro-id="b6c3aa44-7110-48d3-9932-6360896d88f0" ac:name="text-data" ac:schema-version="1">
<ac:parameter ac:name="name">color</ac:parameter>
<ac:parameter ac:name="type">line</ac:parameter>
<ac:parameter ac:name="content">text</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
</div>
</td>
</tr>
</tbody>
</table>
</ac:rich-text-body>
</ac:structured-macro>

Code Block 2

<table class="wrapped" style="letter-spacing: 0.0px;">
<colgroup> <col/> <col/> </colgroup>
<tbody>
<tr>
<th>name</th>
<td>
<div class="content-wrapper">
<ac:structured-macro ac:macro-id="80353b93-36bc-43b8-874f-faf83809e135" ac:name="text-data" ac:schema-version="1">
<ac:parameter ac:name="name">name</ac:parameter>
<ac:parameter ac:name="type">line</ac:parameter>
<ac:parameter ac:name="content">text</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">BLOCK</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
</div>
</td>
</tr>
<tr>
<th>color</th>
<td>
<div class="content-wrapper">
<ac:structured-macro ac:macro-id="1dfd928c-2c04-4e19-8da9-ee4996fe8742" ac:name="list-data" ac:schema-version="1">
<ac:parameter ac:name="blank">false</ac:parameter>
<ac:parameter ac:name="name">color</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">BLOCK</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="c87dbaa9-27e9-4cd4-a876-7ecfcc385aad" ac:name="report-block" ac:schema-version="1">
<ac:parameter ac:name="injected">true</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">BLOCK</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="0b26eaf1-c4e9-426a-bfdc-b4f8f3b47649" ac:name="expanding-reporter" ac:schema-version="1">
<ac:parameter ac:name="as">row</ac:parameter>
<ac:parameter ac:name="">data:t_colors</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="c1f274c0-bfc5-48f6-a5ee-31384689574c" ac:name="local-reporter" ac:schema-version="1">
<ac:parameter ac:name="">page:parent &gt; page:children</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="7ce50918-4ecf-4964-aef2-12becb1d3857" ac:name="text-filter" ac:schema-version="1">
<ac:parameter ac:name="value">Colors</ac:parameter>
<ac:parameter ac:name="">page:title</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="0a6aa8ce-9a99-40b1-aeef-677462ad7f5c" ac:name="report-body" ac:schema-version="1">
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="c4c32ab3-66e4-4288-812e-4d2c540830c4" ac:name="list-option" ac:schema-version="1">
<ac:parameter ac:name="sortValue">%expanded:row &gt; data:color%</ac:parameter>
<ac:parameter ac:name="label">%expanded:row &gt; data:color%</ac:parameter>
<ac:parameter ac:name="value">%expanded:row &gt; data:id%</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
</div>
</td>
</tr>
</tbody>
</table>

Code Block 3

<ac:structured-macro ac:macro-id="643ba4ba-81d9-4303-8dbd-32ab3b5e013d" ac:name="report-table" ac:schema-version="1">
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="d06a69d3-c910-4fd6-9615-fd5745dc5fe2" ac:name="local-reporter" ac:schema-version="1">
<ac:parameter ac:name="">page:parent &gt; page:descendants</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="0526489d-07e1-4a73-964d-98c72b56f175" ac:name="text-filter" ac:schema-version="1">
<ac:parameter ac:name="contains">form</ac:parameter>
<ac:parameter ac:name="">page:labels</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="2aab0b51-42c7-469a-9e5c-aaa943f8ce5e" ac:name="report-column" ac:schema-version="1">
<ac:parameter ac:name="title">name</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="935493a9-3eb9-4983-8d5d-67efc78f1444" ac:name="report-info" ac:schema-version="1">
<ac:parameter ac:name="">data:name</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="609cad41-757d-41d4-b846-bbf8f1845297" ac:name="report-column" ac:schema-version="1">
<ac:parameter ac:name="injected">true</ac:parameter>
<ac:parameter ac:name="title">color</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="7f2a1ff7-d89c-4434-aebf-04b7b2fa2b89" ac:name="report-block" ac:schema-version="1">
<ac:parameter ac:name="atlassian-macro-output-type">BLOCK</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="842835df-fcf3-4073-834a-9a2c0652fc75" ac:name="expanding-reporter" ac:schema-version="1">
<ac:parameter ac:name="as">row</ac:parameter>
<ac:parameter ac:name="">data:t_colors</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="9b2d0064-e4da-4ee5-9ae4-4d110059ef74" ac:name="local-reporter" ac:schema-version="1">
<ac:parameter ac:name="">page:parent &gt; page:children</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="26f9e59c-5673-4454-8e0a-3dfb4993b75b" ac:name="text-filter" ac:schema-version="1">
<ac:parameter ac:name="value">Colors</ac:parameter>
<ac:parameter ac:name="">page:title</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<ac:structured-macro ac:macro-id="8c5f20c2-a635-410d-8d8f-16b9d643fa96" ac:name="number-filter" ac:schema-version="1">
<ac:parameter ac:name="value">%data:color%</ac:parameter>
<ac:parameter ac:name="">expanded:row &gt; data:id</ac:parameter>
</ac:structured-macro>
</p>
<ac:structured-macro ac:macro-id="8fd135ec-0315-4283-8adc-aa4fb109601e" ac:name="report-body" ac:schema-version="1">
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="178c1725-d9c1-4389-9cc0-e7c939163122" ac:name="report-info" ac:schema-version="1">
<ac:parameter ac:name="">expanded:row &gt; data:color</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>

 

Christian Brümmer October 10, 2019

Hello Martin,

thank you very much... I see, yes, your solution is complicated and I see, your support is great!

I'm currently not doing anything regarding scaffolding, so I don't have got time, to check your idea.

If my tasks will change and it is getting relevant again, I will check this and give feedback!

Thank you

Christian

0 votes
IT Admin December 7, 2018

According to the customner support, this is not yet possible, see https://success.servicerocket.com/support/servicedesk/customer/portal/3/SRSUP-3240

I copied your description and added it as an idea for the reporting plugin:

https://ideas.atlassian.servicerocket.com/ideas/REP-I-37

Please vote for it as well if you want to support it!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events