Table filter and Content Report Table is sorting strangely
Asked by Anders Kj?llerstr?m:

I'm trying to get a list of pages with descending sort order. I've identified that this is not possible in the native Content Report Table. So I've placed a content report inside a Table filter, sorting it on Title. This is the sort order I get:

![Conf1.PNG](/t5/image/serverpage/image-id/165133i43F803C9970EAD4A/image-size/large?v=v2&px=999 "Conf1.PNG")

Notice that it is not sorted by Title, Creator or Modified date.

In the tree structure these pages sort just fine, but only ascending as per default. So there should not be an issue with the ASCII.

What is going on here? I'm the space admin.

thanks Anders


Answers:
author: Katerina Kovriga {Stiltsoft}
body: Hi [@Anders Kj?llerstr?m](/t5/user/viewprofilepage/user-id/4515898) ,

I've checked the Content Report Table macro in our test Server instance where its columns are sortable - the sorting goes exactly as described into your case: pages with plain names are sorted just fine, but Meeting notes are presented as they are in the Page Tree.

The Table Filter macro just catches the initial Confluence sorting and allows it to be set as a default one.

I can suggest using the following workaround for your case: wrap the Content Report Table macro into the [Table Transformer](https://docs.stiltsoft.com/display/public/TFAC/How+to+use+Table+Transformer+macro) macro and then into the Table Filter macro.

For Server and Data Center it can be done directly:

![Fri 9-2.png](https://community.atlassian.com/t5/image/serverpage/image-id/165145i3C20C323903A9E97/image-size/large?v=v2&px=999 "Fri 9-2.png")And for Cloud via the [Table Toolbox](https://docs.stiltsoft.com/display/public/TFAC/How+to+use+Table+Toolbox+macro) macro:

![Fri 9-1.png](https://community.atlassian.com/t5/image/serverpage/image-id/165146i1BAB16F160746604/image-size/large?v=v2&px=999 "Fri 9-1.png")

Then we go to the Table Transformer macro and split the Title column to get only dates from the Meeting notes pages:

![Fri 9-3.png](https://community.atlassian.com/t5/image/serverpage/image-id/165147i6DCC67AAACE7B78A/image-size/large?v=v2&px=999 "Fri 9-3.png")

SELECT T1.'Title'-\>split(" Meeting notes ")-\>0 AS 'Modified Title for Sorting',  
T1.'Title', T1.'Creator', T1.'Modified'  
FROM T1

![Fri 9-4.png](https://community.atlassian.com/t5/image/serverpage/image-id/165149iB7D3E4E2CCBFB4C9/image-size/large?v=v2&px=999 "Fri 9-4.png")

Then we go to the Table Filter macro and set the default sorting for the new column:

![Fri 9-5.png](https://community.atlassian.com/t5/image/serverpage/image-id/165150iDEBC4E7ACEA767F7/image-size/large?v=v2&px=999 "Fri 9-5.png")

Now our Meeting notes pages are sorted by dates correctly.

The last step is to hide our additional column: Filters -\> Hide Columns and Filtration -\> Set filters' default values:

![Fri 9-6.png](https://community.atlassian.com/t5/image/serverpage/image-id/165151i26C798940D04D391/image-size/large?v=v2&px=999 "Fri 9-6.png")

![Fri 9-7.png](https://community.atlassian.com/t5/image/serverpage/image-id/165152i70B8D9CD24E1C48B/image-size/large?v=v2&px=999 "Fri 9-7.png")

![Fri 9-8.png](https://community.atlassian.com/t5/image/serverpage/image-id/165153i9101339E1BE25E37/image-size/large?v=v2&px=999 "Fri 9-8.png")

Hope this works.

comments: author: Alexander Bondarev
body: [@Katerina Kovriga {Stiltsoft}](/t5/user/viewprofilepage/user-id/1464746) , wow! I have to reproduce it! Thanks!


author: Anders Kj?llerstr?m
body: [@Katerina Kovriga {Stiltsoft}](/t5/user/viewprofilepage/user-id/1464746) Thank you so much!

Very helpful and easy to follow, even for a noob such as myself.

When I try, for some reason, the modified column only executes on some of the lines.

Some of the meeting notes pages were named programatically, some were named by typing manually. I cannot see that there is any difference in what and how characters are used. Could this be it?

I've assumed that the title is just a String, and that this could not affect the outcome...

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/165408iCBF72D8F281815C5/image-size/large?v=v2&px=999 "image.png")


author: Katerina Kovriga {Stiltsoft}
body: And will anything change if you delete the spaces from the query?

SELECT T1.'Title'-\>split(**" Meeting notes "**)-\>0 AS 'Modified Title for Sorting',  
T1.'Title', T1.'Creator', T1.'Modified'  
FROM T1

-\>

SELECT T1.'Title'-\>split**("Meeting notes")** -\>0 AS 'Modified Title for Sorting',  
T1.'Title', T1.'Creator', T1.'Modified'  
FROM T1

We'll see if the difference is in some invisible characters that differ from the regular spaces.


author: Anders Kj?llerstr?m
body: Thanks!  
Copy pasted the above, and no change.

I also tried to retitle one of the meetings that behave strangely. I copied the title from a meeting that behaves as expected, but still it doesn't trim the text.


author: Katerina Kovriga {Stiltsoft}
body: Oh, it is because you have "XXXX-XX-XX Demo meeting" for the second place marked on the screenshot.

This query

SELECT T1.'Title'-\>split("Meeting notes")-\>0 AS 'Modified Title for Sorting',  
T1.'Title', T1.'Creator', T1.'Modified'  
FROM T1

checks every page name for the **Meeting notes** phrase and leaves the left part with the date. If there is no such part, then the string is left as it was.

Let's try the following option: use this query for your Table Transformer

SELECT SUBSTRING(T1.'Title', 1, 10) AS 'Modified Title for Sorting',  
T1.'Title', T1.'Creator', T1.'Modified'  
FROM T1

Here we leave only dates from our Meeting notes or the first 10 symbols from any page name we have.

Then we move to the Table Filter macro and set two default sortings: for the "Modified Title for Sorting" (then we hide this column) and an additional one for the "Title" column because you have pages with regular names without dates:

![Mon 6-1.png](https://community.atlassian.com/t5/image/serverpage/image-id/165422i0F3B54E1171FE0A3/image-size/large?v=v2&px=999 "Mon 6-1.png")


author: Anders Kj?llerstr?m
body: Yes! that does it, thank you so much Katerina!

I still don't really understand why we had to do a workaround for this, but that is another thing.

Again, thank you Katerina

all the best

anders


Tags: cloud

confluence-cloud

report