Hi Team,
I need to sort page by custom property called sequence.
I have created Custom property called sequence for page.
So that each page have custom property like page1 will have sequence number is 1
page 2 will have sequence number 2
for some page there won't be sequence number now i need to sort in such a way that the pages with have sequence number in ascending order and if page won't have sequence number it should come last.
Can some one help me with predicate for sort in above manner.
Solved! Go to Solution.
Views
Replies
Total Likes
try below and see if that works for you. It gives only if the property exists.
type=cq:Page
path=/content/we-retail/us/en/contact
property=@jcr:content/sequence
property.operation=exists
orderby=@jcr:content/sequence
orderby.sort=asc
p.offset=3
p.limit=3
----- AND below for other pages where the property doesn't exist.
type=cq:Page
path=/content/we-retail/us/en/contact
property=@jcr:content/sequence
property.operation=not
p.offset=3
p.limit=3
I would suggest to do by fetching all the pages and bucket the one with sequence property in separate list and do sort the list by sequence and other list for pages don't have sequence property and merge the list.
I don't think you can achieve both with single query. so You can try with two different queries and store in in the list & later merger them.
Sample Query:
path=/content/abc
type= cq:Page
orderby=@jcr:content/jcr:title
orderby.sort=ascp.limit=-1
HI Siva,
Thanks for your quick reply.
My requirement is we have 10 pages among 10 pages 5 pages have sequence number and five pages not have sequence number.
when i use Query builder like below
type=cq:Page
path=/content/we-retail/us/en/contact
orderby=@jcr:content/sequence
orderby.sort=asc its giving without sequence first and then with sequence number.
I am using pagination so each time i need 3 records so i have used p.offset=3
p.limit=3
query builder will be
type=cq:Page
path=/content/we-retail/us/en/contact
orderby=@jcr:content/sequence
orderby.sort=asc
p.offset=3
p.limit=3
It will give 3 pages without sequence first
I need to get with sequence first how i can achive these.
try below and see if that works for you. It gives only if the property exists.
type=cq:Page
path=/content/we-retail/us/en/contact
property=@jcr:content/sequence
property.operation=exists
orderby=@jcr:content/sequence
orderby.sort=asc
p.offset=3
p.limit=3
----- AND below for other pages where the property doesn't exist.
type=cq:Page
path=/content/we-retail/us/en/contact
property=@jcr:content/sequence
property.operation=not
p.offset=3
p.limit=3
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies