need help reporting on table containing scaffolding fields

  • 2
  • Question
  • Updated 2 years ago
I have searched around but am still having problems with this....     I have a table on a Confluence page which contains various Scaffolding fields in each column.     Some columns have more than one scaffolding field.    For example.....

Col1 - scaffolding field is X
Col2 - scaffolding field is Y and another scaffolding field is Z
Col3 - scaffolding field is W

I want to create a report from a separate space that displays some of that data.   ie I would like:

Report col 1 - scaffolding data from field X
Report col 2 - scaffolding data from field Z

How do I do this?   I know it is something around nesting a content reporter inside of an expanding reporter but I can't seem to get it to work.

In addition, I would like to be able to filter (ie only show rows where field W = 3

Can anyone point me to a description that clearly shows how to do this?

Thanks

Harley
Photo of Harley Payne.

Harley Payne.

  • 9 Posts
  • 0 Reply Likes

Posted 3 years ago

  • 2
Photo of Nurhana Ziana Bt. Hanafi

Nurhana Ziana Bt. Hanafi, Employee

  • 3500 Posts
  • 269 Reply Likes
Hello Harley,

Are all your fields wrapped in a {table-data}? If yes, then you would need {expanding-reporter} and pull the data via Expanded Supplier. For example:
{report-table:injected=true}
{expanding-reporter:data:tableName|as=myTbl}
{local-reporter:page:descendants|source=spaceKey:ancestorName}
{local-reporter}
{number-filter:data:W|value=3}
{expanding-reporter}
{report-column:title=Page Title} {report-info:expanded:item > page:title} {report-column}
{report-column:title=X} {report-info:expanded:myTbl > data:X} {report-column}
{report-column:title=Z} {report-info:expanded:myTbl > data:Z} {report-column} {report-table}
Hope this helps.


Thanks&Regards,
Ziana
Photo of Mike

Mike

  • 2 Posts
  • 0 Reply Likes
The "{report-info:expanded:item > page:title}" doesn't seem to work...
I've got a similar setup of a {table-data} item (called "Notes") so users can add notes to records. I no w want to report a list of all notes over all records. Here's my wiki:

{report-table}
{expanding-reporter:data:Notes|as=note}
{local-reporter:page:descendents|source=SR:Records}
{text-sort:page:title}
{local-reporter}
{expanding-reporter}

{report-column:title=Record}{report-info:expanded:note>page:title}{report-column}
{report-column:title=Note Text}{report-info:expanded:note>data:NoteText}{report-column}
{report-table}

The resulting table reports the note texts correctly, but does not report the parent titles. What am I doing wrong?
(Edited)
Photo of Mike

Mike

  • 2 Posts
  • 0 Reply Likes
Nevermind. Solved. The problem was that I was using the "as" placeholder instead of "item"

So where I had (doesn't work): {report-column:title=Record}{report-info:expanded:note>page:title}{report-column}

This should have been (works): {report-column:title=Record}{report-info:expanded:item>page:title}{report-column}
(Edited)
Photo of Harley Payne.

Harley Payne.

  • 9 Posts
  • 0 Reply Likes
Hello...   I tried your code but it is still returning an empty report for me.    Not sure what I am doing wrong...    is it something with the fact that I am trying to report from a separate Space?   A couple of questions:

1) in your code you have:  source=spaceKey:ancestorName    I assume that this is the actual page where the scaffolding table resides?   I always get confused with ancestor/descendant nomenclature....    
2) If that page has spaces in the name then do I need to encapsulate with quotes?   ie source="spaceKey:This is my page name"
3) You have - expanding-reporter:data:tableName.   Is that meant to be the same name as in the Scaffolding Table Data macro?

I have tried a few different things here but none of it seems to work...  always returns an empty report (even with no number filter).

What am I missing?

Thanks
Photo of Nurhana Ziana Bt. Hanafi

Nurhana Ziana Bt. Hanafi, Employee

  • 3500 Posts
  • 269 Reply Likes
Hello Harley,

Kindly please find my answers below:

1) "spaceKey" should be the key of space; "ancestorName" is ancestor's page name/title of of descendents, descendents are the pages having Scaffolding fields.
2) No need to encapsulate with quotes
3) Yes


Thanks&Regards,
Ziana
Photo of Harley Payne.

Harley Payne.

  • 9 Posts
  • 0 Reply Likes
Ok....  I just got it to work by basically pointing at the page above where I wanted (ie I guess that is the ancestor?) and then having the page:descendents pull the table from the real page.    Is there no way to more directly point though to a specific page?

For example why can I not just say 

{local-reporter:page:body|source=spaceKey:actualpageIwant}
Photo of Nurhana Ziana Bt. Hanafi

Nurhana Ziana Bt. Hanafi, Employee

  • 3500 Posts
  • 269 Reply Likes
Hello Harley,

Is it only 1 page having Scaffolding fields that you would like to pull? Or is it consist of several pages?


Thanks&Regards,
Ziana
Photo of Harley Payne

Harley Payne

  • 9 Posts
  • 0 Reply Likes
Yes in this case it is just one page
Photo of Nurhana Ziana Bt. Hanafi

Nurhana Ziana Bt. Hanafi, Employee

  • 3500 Posts
  • 269 Reply Likes
Hello Harley,

For 1 page only, it would be pretty straightforward. No need to use {expanding-reporter} e.g.
{report-table:injected=true}
{local-reporter:data:tableName|source=spaceKey:pageName}
{number-filter:data:W|value=3}
{local-reporter}
{report-column:title=X} {report-info:data:X} {report-column}
{report-column:title=Z} {report-info:data:Z} {report-column} {report-table}
Hope this helps :)


Thanks&Regards,
Ziana
Photo of Harley Payne

Harley Payne

  • 9 Posts
  • 0 Reply Likes
Ok thanks I will give that a try. I thought I needed the expanding reporter since it was a table with multiple rows. So the local reporter will return each all the rows itself?
Photo of Nurhana Ziana Bt. Hanafi

Nurhana Ziana Bt. Hanafi, Employee

  • 3500 Posts
  • 269 Reply Likes
Hello Harley,

In case you're pulling Scaffolding data  from 1 page only, then you could simply use {local-reporter} to iterate contents inside {table-data}.

You would only need {expanding-reporter} when taking data from many pages, where {local-reporter} or {content-reporter} to look for those pages, then {expanding-reporter} to iterate {table-data} contents.

Hope this will clarify your doubts.


Thanks&Regards,
Ziana
Photo of Harley Payne.

Harley Payne.

  • 9 Posts
  • 0 Reply Likes
ok, that is working thanks.    One other question.....    how do I filter on value in a List-Data object?   I was trying to use a text filter on it but it does not seem to be working.
Photo of Nurhana Ziana Bt. Hanafi

Nurhana Ziana Bt. Hanafi, Employee

  • 3500 Posts
  • 269 Reply Likes
For List-Data object in {text-filter}, kindly please use below keychain annotation:

{text-filter:data:myListDataName>collection:first|value=ABC}

Hope this helps.
Photo of Harley Payne.

Harley Payne.

  • 9 Posts
  • 0 Reply Likes
Ok so....   that is all working, but I have another related issue.   The scenario is that I have three pages.    Each page has on it a list-data object which has multiple defined choices.    (each list is allowed to have multiple items selected).     How do I create a report that lists the page title of any page where one of the items on the list is selected?

I have been trying to use expanding reporter or a collection filter etc but really having no luck.    Each of the pages that I want to look in has a specific label that I can use to identify them.

Thanks
Photo of Harley Payne.

Harley Payne.

  • 9 Posts
  • 0 Reply Likes
I am starting to think this is more complicated because the list I have is actually a list of Confluence pages.    It was populated using a Content Options macro to give me the list of pages, then I go in via scaffolding and check off multiple pages.     Do I need to use the reference supplier or something to get it to filter?     So my situation is this:

SPACE AA - contains multiple pages, three of which are of interest (call them X, Y, Z).  Each of the pages X, Y, Z has a scaffolding list-data object.   Each of those lists allows multiple selections.    Each of those lists is populated with a list of confluence pages (call those pages   D, E, F).     So, from SPACE BB I want to generate a report which looks at pages X, Y, Z and returns the title of any pages where the list-data contains page E.

Using the expanding reporter with a local reporter inside of it, I did manage to get it to give me a list of all the source pages (X, Y, Z).   I just can't get it to filter properly after that.
Photo of Brandon Ibach

Brandon Ibach

  • 12 Posts
  • 4 Reply Likes
This should be doable by adding, inside your reporter that returns pages X, Y and Z, a collection filter on your list-data, with matchItems=any (i.e., the filter succeeds if any selected item matches).  Inside the collection filter, add a text filter on page:title or a number filter on page:id, setting the value to the title or ID, respectively, of the page (D, E or F) that you're looking for.
Photo of Harley Payne.

Harley Payne.

  • 9 Posts
  • 0 Reply Likes
Thanks for the reply.    I did end up getting it working.    I was able to use the content reporter to pick the pages (since they have labels on them) and then as it turns out you can just use a simple text filter on the list data.    I had this originally but it wasn't working which had me chasing my tail.  

In the end the actual issue was that the page I was filtering on had brackets in the title.   ie "Some text (ABD)"     I think what was going on was that the Text Filter was interpreting the brackets as regular expression syntax and therefore the names were not matching.    I ended up renaming the page to remove the brackets and it immediately worked.
Photo of Nurhana Ziana Bt. Hanafi

Nurhana Ziana Bt. Hanafi, Employee

  • 3500 Posts
  • 269 Reply Likes
Glad it finally works! :)
Photo of Brandon Ibach

Brandon Ibach

  • 12 Posts
  • 4 Reply Likes
Glad you got things working.

Taking a step back, using a text filter directly on list-data is problematic because, even if there is only a single selected item, the comparison is against a list-formatted representation, so instead of "abc", it's something like (IIRC) "[abc]" (or "[abc,def]" for multiple items).  Appending " > first" to the list-data keychain can simplify this for the only-one case, making it easier to do a plain-text comparison, using the "value" parameter of the text filter instead of "include".

In general, while I'm a big fan of regular expressions, I try to avoid using them unless I really need them, as they usually take longer to process than a plain text comparison and can introduce all sorts of nasty bugs due to their sometimes-difficult syntax (assuming you can even remember WHICH syntax your tool uses!).  Using techniques like " > first" and collection filters can help keep things in simple text comparison territory.
Photo of Nurhana Ziana Bt. Hanafi

Nurhana Ziana Bt. Hanafi, Employee

  • 3500 Posts
  • 269 Reply Likes
Many thanks for your input :)
Photo of Harley Payne

Harley Payne

  • 9 Posts
  • 0 Reply Likes
Brandon.... Thanks for the reply.... I agree with what you are saying but I am not sure how else to do it. How do you use the collection filter you were talking about?
Photo of Harley Payne.

Harley Payne.

  • 9 Posts
  • 0 Reply Likes
looked back at your earlier message and saw what you had suggested.   Just tried that this morning and it looks like it is working well.   Thanks for the help.