how to convert page id to page title when page id is just a number

  • 1
  • Question
  • Updated 3 years ago
I am using a grouping reporter which gives me the page:id as output.  However, I need to convert this to the page title.  I was retrieving the page:title as output but when I clicked the checkbox for Link to Item, it didn't link.  This leads me to believe that the output of the group is text.  So, I put a report-link around it.  However, since the value for the page:title is just text, I couldn't get that to work as there were three possible spaces the page could be in.
So, I changed from page:title to page:id so that I could put report-link around it and get it to link to the page.  Now I have a link to the page but the text of the link is the page id, which is confusing to people wanting to know the page title.
I'd like to have the page title display instead of the page id but I can't figure out how to do it.  I thought about wrapping the report-link in another report-link but I'm not sure that will resolve.
Here is the code:
<code>
 <ac:structured-macro ac:macro-id="079ab9c7-e094-4049-b91b-19980fd3d553" ac:name="report-table" ac:schema-version="1">
    <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
    <ac:rich-text-body>
      <ac:structured-macro ac:macro-id="5dd815f4-77ee-4437-b6a2-d077ac34abc3" ac:name="grouping-reporter" ac:schema-version="1">
        <ac:parameter ac:name="as">ParentProduct</ac:parameter>
        <ac:parameter ac:name="">expanded:item&gt;page:id</ac:parameter>
        <ac:rich-text-body>
          <ac:structured-macro ac:macro-id="6d1a5c7a-d053-42bc-9c5c-1f8e64009102" ac:name="expanding-reporter" ac:schema-version="1">
            <ac:parameter ac:name="as">AD</ac:parameter>
            <ac:parameter ac:name="">data:ADLHide</ac:parameter>
            <ac:rich-text-body>
              <ac:structured-macro ac:macro-id="66a22c8d-2b09-4aa5-ac17-80930c7b746e" ac:name="combining-reporter" ac:schema-version="1">
                <ac:rich-text-body>
                  <ac:structured-macro ac:macro-id="49d36ed0-6658-4b47-92f5-62221ae2ef09" ac:name="local-reporter" ac:schema-version="1">
                    <ac:parameter ac:name="source">OPPIP:Cross Program Products</ac:parameter>
                    <ac:parameter ac:name="">page:children</ac:parameter>
                    <ac:rich-text-body>
                      <p> </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>
      <ac:structured-macro ac:macro-id="a6214b93-3d06-48e4-aeac-9b4c335a4daa" ac:name="report-column" ac:schema-version="1">
        <ac:parameter ac:name="title">Parent Product</ac:parameter>
        <ac:rich-text-body>
          <ac:structured-macro ac:macro-id="6eb530a1-8d15-4233-992a-05b49e891543" ac:name="report-link" ac:schema-version="1">
            <ac:parameter ac:name="trim">true</ac:parameter>
            <ac:parameter ac:name="prefix"> </ac:parameter>
            <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
            <ac:parameter ac:name="">grouped:ParentProduct</ac:parameter>
            <ac:rich-text-body>
              <p>
                <ac:structured-macro ac:macro-id="bd408547-a598-4a79-b95a-e56d926c5b66" ac:name="report-info" ac:schema-version="1">
                  <ac:parameter ac:name="link">true</ac:parameter>
                  <ac:parameter ac:name="">grouped:ParentProduct</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>
</code>


I removed some of the code so it might appear a little strange but I think you can understand my question from it.

The output is a link that links to the correct page but the text that is displayed is the page id.

Thanks for any help!
Photo of Kathryn Moye

Kathryn Moye

  • 223 Posts
  • 12 Reply Likes

Posted 3 years ago

  • 1
Photo of Ethan Foulkes

Ethan Foulkes

  • 310 Posts
  • 41 Reply Likes
Hi Kathryn,

I wasn't able to copy paste into source editor which makes it much easier to know what you're doing so I may not be fully understanding the setup but here's a try...

When you have the link working correctly using page:id what are you putting inside of the report-link? You can control the display from what's inside, like a report-info on page:title. For example sometimes I will have a link to a page but will display the space name to people like so:
Photo of Kathryn Moye

Kathryn Moye

  • 223 Posts
  • 12 Reply Likes
Hey Ethan!  Thanks for the reply!  Sorry, I had to take some stuff out of the code that I didn't want on a public forum.  I must have missed something.  The problem with my example is that the grouping reporter is apparently putting out straight text that cannot be keychained??





This Report Info key chain is grouped:ParentProduct>page:title.  grouped:ParentProduct is a page id but won't keychain into the page:title.
There is no output in this example.
If I use grouped:ParentProduct instead of the keychain, it works but displays the page id number instead of a page title name.

Thanks!
Katy
Photo of Ethan Foulkes

Ethan Foulkes

  • 310 Posts
  • 41 Reply Likes
Hi Katy,

Still working on this?

What happens if you replace your Report info with the word test? Does the word test show up as a link to correct page?

If so can you combine this current method with your original method where you were returning the page title but couldn't turn it into a link? You would do this with injection and typing in %data:YourStringThatWasRetreivingPageName% instead of using the Report Info macro.
Photo of Kathryn Moye

Kathryn Moye

  • 223 Posts
  • 12 Reply Likes
Yes I am!  Thanks so much for the help.  I like where you going with this but it isn't working either.  The way I got the page title without a link was by using page:title at the grouping reporter.


This would totally work IF it didn't so happen that I am combining results from two different spaces.  I can't construct the link in report-link to navigate to the page with the page title since I don't know which space it will be from.  Therefore, I decided to use the page:id so I can construct the link..hence my problem. :(  I either get the link or the page title. At this point, I'm not sure which is more useful. :)

page:id URL prefix: https://***/confluence/pages/viewpage.action?pageId=

page:title URL prefix:  https://****/confluence/display/space/pagetitle

Thanks again!!!
Katy
Photo of Kathryn Moye

Kathryn Moye

  • 223 Posts
  • 12 Reply Likes
I still haven't had any word from Service Rocket on this one.  Do you guys have any solutions?

Thanks,
Katy
Photo of Nurhana Ziana Bt. Hanafi

Nurhana Ziana Bt. Hanafi, Employee

  • 3500 Posts
  • 269 Reply Likes
Hello Katy,

Sorry for the late response. Can you let us know field type of ADLHide, is it {table-data} or {text-data}?

Thanks&Regards,
Ziana
Photo of Kathryn Moye

Kathryn Moye

  • 223 Posts
  • 12 Reply Likes
ADLHide is {table-data}.  The first column in the table is list-data, ProdRef, and the options are content options from another space.