user macro with CQL result (unlimited)

KRAFTON Inc_ August 22, 2019

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
Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 23, 2019

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

KRAFTON Inc_ November 12, 2019

Thank you Dario!

Like Dario B likes this
Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 13, 2019

You are very welcome! :) 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events