Confluence || User Macro || Advanced Search || using text search in tabular data

I am able to pull the data in tabular format and able to search text, but I added a column to pull “Label” associated to pages in table. Below is the code I am using. I am unable to pull the label names in table.

Macro Name: filter-all-tables

Macro Title: Filter all tables

Category: Confluence Content

Macro has a body: N

Body processing: None

Source: https://community.atlassian.com/t5/Confluence-articles/The-Admin-s-tale-User-Macro-filtering-a-Confluence-table/ba-p/459369

Date implemented: yyyy-mm-dd

Implemented by: xxx.yyy@zzz.com

@@param FilterID:title=FilterID|type=string|required=true|desc=ID [a-z,A-Z,0-9

@Param Label:title=Label|type=string|required=true|desc=Label

@Param Class:title=Length of the input field|type=enum|enumValues=short-field,medium-field,medium-long-field,long-field,full-width-field|default=long-field

@Param ColumnNumber:title=Column Number|type=string|required=true|default=-1|desc=Specify the column number or “-1” for the entire row

##-----------

@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.

#set ( $containerManagerClass = $content.class.forName(‘com.atlassian.spring.container.ContainerManager’) )
#set ( $getInstanceMethod = $containerManagerClass.getDeclaredMethod(‘getInstance’,null) )
#set ( $containerManager = $getInstanceMethod.invoke(null,null) )
#set ( $containerContext = $containerManager.containerContext )
#set ( $pageManager = $containerContext.getComponent(‘pageManager’) )
#set ( $contentEntityManager = $containerContext.getComponent(‘contentEntityManager’) )
#set ( $labelManager = $containerContext.getComponent(“labelManager”))
#set ($labelManager = $action.getLabelManger())
#set ($labelManager.getLabel($paramLabel))

#set ( $long = $generalUtil.getSystemStartupTime() )
#set ( $cql = $paramCQL.replace(“pageId()”, $content.id.toString()).replace(“spaceKey()”, $space.key) )
#set ( $htmlString = $action.getHelper().renderConfluenceMacro(“{contentbylabel:showLabels=false|showSpace=false|max=500|cql=$cql}”) )
#set ( $tableListings = “” )
#set ( $displayMatch = $req.contextPath + ‘/display/’ )
#set ( $pagesMatch = $req.contextPath + ‘/pages/’ )
#set ( $results = 0)
#foreach ( $linkPart in $htmlString.split(‘href="’) )
#if ( $linkPart.startsWith($displayMatch) || ($linkPart.startsWith($pagesMatch) && !$linkPart.contains(‘focusedCommentId=’)) )
#set ( $results = $results + 1 )
#if ( $linkPart.startsWith($displayMatch) )
#foreach ( $link in $linkPart.split(‘"’) )
#set ( $spaceAndPage = $link.replace($displayMatch, “” ) )
#foreach ( $part in $spaceAndPage.split(“/”) )
#set ( $spaceKey = $part )
#break
#end
#foreach ( $part in $spaceAndPage.split(“/”) )
#set ( $pageTitle = $generalUtil.urlDecode($part) )
#end
#set ( $page = $pageManager.getPage($spaceKey, $pageTitle) )
#break
#end
#end
#if ( $linkPart.startsWith($pagesMatch) )
#foreach ( $link in $linkPart.split(‘"’) )
#foreach ( $section in $link.split(‘pageId=’) )
#set ( $pageId = $section )
#end
#break
#end
#set ( $pageId = $long.parseLong($pageId) )
#set ( $page = $contentEntityManager.getById($pageId) )
#end
#set ( $tableListings = $tableListings + ‘’ )
#set ( $tableListings = $tableListings + ‘’ + $page.title + ‘’)
#set ( $tableListings = $tableListings + ‘’ + $page.creator.fullName + ‘’ )
#set ( $tableListings = $tableListings + ‘’ + $page.labelname + ‘’ )

#set ( $tableListings = $tableListings + ‘’ + $action.dateFormatter.formatDateTime($page.creationDate) + ‘’ )
#set ( $tableListings = $tableListings + ‘’ + $page.lastModifier.fullName + ‘’ )
#set ( $tableListings = $tableListings + ‘’ + $action.dateFormatter.formatDateTime($page.lastModificationDate) + ‘’ )
#set ( $tableListings = $tableListings + ‘’ )
#set ( $page = “” )
#end
#end
#if ( $tableListings.contains(“tr”) )

Found $results results:

$tableListings
Page Created By LabelName Created Date Last Modified By Last Modified Date
#else

No results found for CQL Query $cql

#end