Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

To get all Published page list within specific date

Avatar

Level 4

Hi Team,

I want to list some pages and asset too which has been published in last 20 days.

I am writing below query in query builder but seems something wrong in it.

skumari1_0-1669631355087.png

Can anyone help here

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

For Sites:

path=/content
type=cq:Page
relativedaterange.property=jcr:content/cq:lastReplicated
relativedate.lowerBound=20d

 

For Assets:

path=/content/dam

type=dam:Asset

relativedaterange.property=jcr:content/cq:lastReplicated
relativedate.lowerBound=20d

View solution in original post

4 Replies

Avatar

Community Advisor

Hi @skumari1 You can modify below query to pages. It should work

 

  • If we want to get the assets modified after a particular date, we can use the query as below:

 SELECT * FROM [dam:Asset] AS p WHERE ISDESCENDANTNODE(p, "<path of assets to be traversed>") AND p.[jcr:content/jcr:lastModified] >= CAST("<date>" AS DATE)


 For example: SELECT * FROM [dam:Asset] AS p WHERE ISDESCENDANTNODE(p, "/content/dam") AND p.[jcr:content/jcr:lastModified] >= CAST("2022-04-01T10:36:00.000-05:00" AS DATE)

 

  • If we want to get the assets modified in between a particular date range, we can use the query as below:

 SELECT * FROM [dam:Asset] AS p WHERE ISDESCENDANTNODE(p, “"<path of assets to be traversed>") AND p.[jcr:content/jcr:lastModified] >= CAST("<From date>" AS DATE) AND p.[jcr:content/jcr:lastModified] <= CAST(“<To date>” AS DATE)

 

For example: SELECT * FROM [dam:Asset] AS p WHERE ISDESCENDANTNODE(p, "/content/dam") AND p.[jcr:content/jcr:lastModified] >= CAST("2022-03-01T10:36:00.000-05:00" AS DATE) AND p.[jcr:content/jcr:lastModified] <= CAST("2022-04-20T23:59:59.999Z" AS DATE)

Avatar

Level 4

Hi @Jagadeesh_Prakash 

I have to query last replicated pages/assets so i need to use cq:lastReplicated in place of "jcr:lastModified" in the query?

Avatar

Level 4

Hi @Jagadeesh_Prakash 

When running in query builder its giving the result but while running in sql2

its not giving the result.

skumari1_0-1669633533196.pngskumari1_1-1669633590389.png

 

Avatar

Correct answer by
Employee Advisor

For Sites:

path=/content
type=cq:Page
relativedaterange.property=jcr:content/cq:lastReplicated
relativedate.lowerBound=20d

 

For Assets:

path=/content/dam

type=dam:Asset

relativedaterange.property=jcr:content/cq:lastReplicated
relativedate.lowerBound=20d