In this page
Overview
This page lists sample CQL queries for common use cases around content status. They're completely standard CQL queries, so you can use them as-is, adapt them to your own needs, or freely combine them with any other CQL field or function for more complex searches.
Query samples
Current status
Contents in the status "Expired":
arch.status = "Expired"
Contents in the status #123:
arch.status.id = 123
(Searching by ID is less readable than by name, but stable across renames. Find a status ID via the "arch.status.id" field in Status details → CQL fields tab.)
Contents in the space "Foo" and in the status "Expired":
space = "Foo" and arch.status = "Expired"
Contents in the spaces "Foo" or "Bar" and in the status #123:
space in ("Foo","Bar") and arch.status.id = 123
(Searching by ID is less readable than by name, but stable across renames. Find a status ID via the "arch.status.id" field in Status details → CQL fields tab.)
Expired contents, most recently expired first:
arch.status = "Expired" order by arch.status.changedOn desc
Previous status
A content's previous status is the status it was in right before entering its current one. This is useful when tracking status changes, since it lets you search not just by what a content's status changed from ("previous"), but also by what it changed to ("current").
Contents with previous status "Up-to-date":
arch.previousStatus = "Up-to-date"
Contents with previous status #123:
arch.previousStatus.id = 123
(Searching by ID is less readable than by name, but stable across renames. Find a status ID via the "arch.status.id" field in Status details → CQL fields tab.)
Contents in the space "Foo" and with previous status "Up-to-date":
space = "Foo" and arch.previousStatus = "Up-to-date"
Contents in the spaces "Foo" or "Bar" and their current status changed from status #123:
space in ("Foo","Bar") and arch.previousStatus.id = 123
(Searching by ID is less readable than by name, but stable across renames. Find a status ID via the "arch.status.id" field in Status details → CQL fields tab.)
Contents with previous status "Expired", most recently updated first:
arch.previousStatus = "Expired" order by arch.status.changedOn desc
Status change
Contents with their status changed in the last 24 hours:
arch.status.changedOn > now("-24h")
Contents in the status "To archive" and changed to that this week:
arch.status = "To archive" and arch.status.changedOn > startOfWeek()
Contents transitioned from status "Expired" to "Up-to-date" in the last 7 days:
arch.previousStatus = "Expired" and arch.status = "Up-to-date" and arch.status.changedOn > now("-7d")
Questions?
Ask us any time.