Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Sort attachment macro numerically

Nikki Hailey
Contributor
August 9, 2021

We have a list of attachments that are all numbered according to a structure within another program. When we set the Attachments macro to sort by name, it sorts it by the leading character instead of the entire leading number, so instead of having a list of 1, 2, 3, 4, etc... we have 1, 10, 11, 12, 2, 3. There has to be a way around this, but I cannot find it.

Thanks

Confluence Attachment Numeric Sort.jpg

2 answers

1 accepted

1 vote
Answer accepted
Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 9, 2021

Unfortunately, file names are considered strings so they are sorted alphabetically. Normally when I have files that need to be sorted numerically by date I name them thusly ... YYYYMMDD_MyFile.xlsx. That way they will sort correctly.

Nikki Hailey
Contributor
August 10, 2021

What if you wanted to sort them numerically, not by date? The date in our file names is the same in each file, we need them to sort numerically. I stopped at 12 when I saw what was happening, but we have many more that need to be added. I guess I can just add them as links, but then I will have to go back and manually add links whenever someone adds a new file, which defeats the purpose of having a macro to sort them for us. (I know it's not your fault, just venting!)

Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 20, 2021

Hi Nikki,

What Davin mentioned is correct. Confluence sorts the files alphabetically and not numerically, and so the best recommendation is to name your files as in Davin's example.

I wanted to follow-up with you because we have had a few open feature requests about this, such as

Note the first request has been closed, but the 2nd one is relevant, even though it mentions the Children display macro. Confluence sorts all content this way.

As @Natalie Paramonova _Stiltsoft_ recommended, if you don't want to rename your attachment names, you need to install a Marketplace app to introduce this feature to Confluence.

I hope that helps, but let me know if you have any questions.

Take care,

Shannon

4 votes
Natalie Paramonova _Stiltsoft_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 10, 2021

Hi @Nikki Hailey , as a workaround, you can use the Table Filter macro that provides a number of options for better table viewing, including sorting (you can even sort by multiple columns if needed).

2021-08-10_10h47_09.png

The result:

2021-08-10_10h47_35.png

Nikki Hailey
Contributor
August 10, 2021

Thank you, but we don't have the bundle that includes the Table Filter macro.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events