Development

Filtering queries based on multi-value fields

Using the querytool, you may have a need to filter based on pages with specific checkbox or multi-select values selected. While filtering on these multi-value fields is not possible in a single query, it can be done using some additional logic. Rather than using something like the following:

$_.query().bySiteName("CascadeUniversity").byContentType("Page Types/News").hasStructuredData("details/is-featured", "Yes").execute()

You can iterate over the results of your query and utilize a conditional statement to get the desired results. For example:

#set ($list = $_.query().bySiteName("CascadeUniversity").byContentType("Page Types/News").execute())
#foreach ($page in $list)
#if ($page.getStructuredData("details/is-featured").hasTextValue("Yes"))
...your code here...
#end
#end