Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Query to fetch Assets where jcr:content/metadata/jcr:lastModified is greater than jcr:content/cq:lastReplicated

Selva123
Level 3
Level 3

Hi All,

I need to fetch the assets where "jcr:content/metadata/jcr:lastModified is greater than jcr:content/cq:lastReplicated".

Is it possible to compare to two metadata values while querying. Please help me in writing the query for this scenario.

So far I am aware is the daterange predicate which is querying a metadata date property against a specific date.

Thanks,

Selva

3 Replies
pradeepn6086740
Level 2
Level 2

HI Selva123

Did you able to solve the issue?

Thanks,

Pradeep

Arun_Patidar
Community Advisor
Community Advisor

I don't think so we can compare dynamic operand with another dynamic operand but static values

DynamicOperand Operator StaticOperand

you can try to write simple servlet to achieve this, without writing queries or use Sling Queries instead of JCR queries.

cq5 - JCR SQL2 compare properties on same node - Stack Overflow

Sling Query vs JCR