It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

user macro with CQL result (unlimited)

l had view "https://community.atlassian.com/t5/Confluence-questions/User-macro-with-CQL-result/qaq-p/721816" and used the contentbylabel macro.

But max result of contentbylabel macro is 500.
I wanna more cql search result.

Do you have any idea?

I used this code.

## @param CQL:title=CQL Query|type=string|required=true|default=type = page and |desc=Enter CQL Query here, use pageId() to refer to current page ID and spaceKey() to refer to current space key.
## @param STARTDATE:title=StartDate|type=string|required=true|desc=From Date.
## @param ENDDATE:title=EndDate|type=string|required=true|desc=To date

#set ( $day1 = $paramSTARTDATE )
#set ( $day2 = $paramENDDATE )

#set ( $cql = $paramCQL.replace("pageId()", $content.id.toString()).replace("spaceKey()", $space.key) )
#set ( $cql = $cql +' and created >= "' + $day1 + '" and created <= "' + $day2 +'"' )
#set ( $htmlString = $action.getHelper().renderConfluenceMacro("{contentbylabel:showLabels=false|showSpace=false|max=1000|cql=$cql}") )

#set ( $results = 0)


#foreach ( $linkPart in $htmlString.split('href="') )
#set ( $results = $results +1 )
#end
<p> $day1 ~ $day2 Found $results results.</p>

 

1 answer

1 accepted

0 votes
Answer accepted

Hello @KRAFTON_Inc_ ,

As mentioned in the Content By Label macro page, the max results limit is indeed set to 500 and there is no way to increase it.

However, I can see that in a previous community post another user pasted the code to create a user macro that returns the full list of results:

 

Please review above thread and let us know if it helps.

 

Cheers,
Dario

Thank you Dario!

Like Dario_Bonotto likes this

You are very welcome! :) 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

How is your team having fun and bonding, remotely, utilizing Confluence?

Thanks everyone for answering last week’s question. The winner of the random drawing from those who commented is: @LarryBrock I’ll contact you separately with your prize details. This wee...

306 views 9 7
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you