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
BedrockMission!

Learn More

View all

Sign in to view all badges

querybuilder groups

Avatar

Avatar
Validate 25
Level 3
vasimakram
Level 3

Likes

10 likes

Total Posts

78 posts

Correct Reply

2 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile

Avatar
Validate 25
Level 3
vasimakram
Level 3

Likes

10 likes

Total Posts

78 posts

Correct Reply

2 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile
vasimakram
Level 3

11-04-2018

I have multiple nodes with node name abc in AEM repository. For some of the nodes it will have property expirationDate. I need to get all the nodes with node name abc. If in case that node has expirationDate property then exclude all the expired nodes. Is there any query which returns this instead of getting all the nodes then checking each node whether it is expired or not?

adding sample content json :

{

   "jcr:primaryType":"cq:Page",

   "jcr:createdBy":"admin",

   "jcr:created":"Wed Apr 11 2018 17:01:59 GMT+0530",

   "page1":{

      "jcr:primaryType":"cq:Page",

      "jcr:createdBy":"admin",

      "jcr:created":"Wed Apr 11 2018 17:02:16 GMT+0530",

      "abc":{

         "jcr:primaryType":"nt:unstructured",

         "expiration":"2018-04-8"

      }

   },

   "page2":{

      "jcr:primaryType":"cq:Page",

      "jcr:createdBy":"admin",

      "jcr:created":"Wed Apr 11 2018 17:04:15 GMT+0530",

      "abc":{

         "jcr:primaryType":"nt:unstructured",

         "expiration":"2018-04-10"

      }

   },

   "page3":{

      "jcr:primaryType":"cq:Page",

      "jcr:createdBy":"admin",

      "jcr:created":"Wed Apr 11 2018 17:04:41 GMT+0530",

      "abc":{

         "jcr:primaryType":"nt:unstructured",

         "expiration":"2018-04-25"

      }

   },

   "page4":{

      "jcr:primaryType":"cq:Page",

      "jcr:createdBy":"admin",

      "jcr:created":"Wed Apr 11 2018 17:05:07 GMT+0530",

      "abc":{

         "jcr:primaryType":"nt:unstructured"

      }

   }

   "page5":{

      "jcr:primaryType":"cq:Page",

      "jcr:createdBy":"admin",

      "jcr:created":"Wed Apr 11 2018 17:05:07 GMT+0530",

      "abc":{

         "jcr:primaryType":"nt:unstructured"

      }

   }

}

In this example current date is 2018-04-11 (YYYY-MM-dd). page1/abc and  page2/abc nodes are expired. Output should have

page3/abc

page4/abc

page5/abc

Thanks in advance.

Regards,

Vasim

Replies

Avatar

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

450 likes

Total Posts

1,024 posts

Correct Reply

116 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

450 likes

Total Posts

1,024 posts

Correct Reply

116 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile
Veena_Vikram
MVP

03-10-2018

You cannot check a property value against currentdate using query builder. You might have to get the nodes with the espirationDate set and then filter those which is expired

I think Arun gave the right answer

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,279 likes

Total Posts

3,156 posts

Correct Reply

889 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,279 likes

Total Posts

3,156 posts

Correct Reply

889 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

03-10-2018

Below is the query for QueryBuilder Debugger

Query

path=/content/

type=nt:unstructured

nodename=abc

daterange.property=expiration

daterange.lowerBound=2018-04-10

p.limit=-1

XPATH Query

/jcr:root/content//element(*, nt:unstructured)

[

((@expiration > xs:dateTime('2018-04-10T00:00:00.000+05:30'))
and fn:name()
= 'abc')

]