Variable for "Page Title" in Properties Report filter?
Asked by Scott Beeson:

I have a Page Properties Report on a page called "Test Page 1". It has a filter for "Including Text" and I have typed in "Test Page 1". Basically, this lists all pages that reference this page, as well as defined properties.

My question is, can I reference the page name via some sort of variable so I don't have to change this for every page?

Basically, something like this:

![2018-09-26 15_51_57-Window.png](/t5/image/serverpage/image-id/33437iEC2AEED2BE20D572/image-size/large?v=v2&px=999 "2018-09-26 15_51_57-Window.png")

Is this possible?


Answers:
author: Bill Bailey
body: Well this variable and method is available, but not clear it will work in the macro as a field: $content.getTitle()

I am not exactly clear what you want to do, but take a look at the docs on the CQL field/filter. It does allow references to ancestors and parents.

[page-properties-report-macro](https://confluence.atlassian.com/doc/page-properties-report-macro-186089616.html)

comments: author: Scott Beeson
body: Unfortunately, that does not work. As far as "what I want to do", not sure how to be more clear. Here are two screenshots that might help. I would like to have the same results with both, but as you can see I do not:

![2018-09-27 10_07_41-Edit - Streaming System - Confluence.png](https://community.atlassian.com/t5/image/serverpage/image-id/33507i26AC50F12AE63F6B/image-size/large?v=v2&px=999 "2018-09-27 10_07_41-Edit - Streaming System - Confluence.png")![2018-09-27 10_08_18-Edit - Streaming System - Confluence.png](https://community.atlassian.com/t5/image/serverpage/image-id/33508i4572979CAC5DC6E8/image-size/large?v=v2&px=999 "2018-09-27 10_08_18-Edit - Streaming System - Confluence.png")


author: Bill Bailey
body: Well I am not sure what you mean by
> Basically, this lists all pages that reference this page, as well as defined properties.

References how? Links to it?  

Did you try adding a filter and using the CQL filter using **With title** ? Or can you filter looking only at child pages (**With ancestor**), or via page labels?

This may also be a case where a user macro wrapper is what you want to do. Basically create a user macro that retrieves $content.getTitle(), inserting it as a parameter in the report macro. This is a trick I use often to pass special settings OR restrict options for users.


author: Scott Beeson
body: Screenshot 1 shows what I'm doing right now. I'm putting the page title in the "Including Text" filter. It does exactly what I want. "Streaming System" is the title of the page. Any pages that mention the "Streaming System" will then show up in the table. This is what I want. This is working.

The problem is that when I go to make this a template, I'll have to change that field every time. I'd rather access the title dynamically via a variable.

**With Title** and **With Ancestor** filters will not help.


author: Bill Bailey
body: Yeah, look at my edit. A user macro wrapper is what you want.


author: Scott Beeson
body: I use cloud, so I assume that's not an option... :(

Thanks for your time anyway.


author: Bill Bailey
body: Ah! Yet another reason to not use cloud. ;-)

BUT I had another thought, if you have access to server Confluence, you can develop and test your user macro, THEN package it as a plugin. Maybe that is a workaround? You would need to confirm with Atlassian support. But to prevent that method, they would have to deny one module type in a plugin.

To get you pointed in the right direction

<https://developer.atlassian.com/server/confluence/user-macro-module/>


Tags: macro

variable