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

SOLVED

XPATH Query Question

vdhim23
Level 5
Level 5

Hi,

I am trying to get all the orders under user. I am using below XPTAH query.

/jcr:root/home/users/a/admin/commerce/orders//element(*)[@orderId] this result below records :

/home/users/a/admin/commerce/orders/order-2014-Apr-12 /home/users/a/admin/commerce/orders/order-2015-Apr-15 /home/users/a/admin/commerce/orders/order-2015-Apr-13

Now i have requirements that order should be in the sorted order as per booked(that i am looking for) , Other is i will have dynamic parameter which will I pass through the method in which i have the XPTH query executed e.g. 6 or ALL . 6 will display the last 6 months order only (that i am looking for). For all orders i can use the above query with sort condition. 

Below is QueryBuilder Query which also give me records but not for 6 months:

type=unstructured
path=/home/users/a/admin/commerce/orders
path.flat=true
orderby=@orderPlaced
orderby.sort=desc

Or some one has any idea about SQL2 Query for same use-case, Please tell.

Thanks

1 Accepted Solution
vdhim23
Correct answer by
Level 5
Level 5

vdhim23 wrote...

Hi,

I am trying to get all the orders under user. I am using below XPTAH query.

/jcr:root/home/users/a/admin/commerce/orders//element(*)[@orderId] this result below records :

  1. /home/users/a/admin/commerce/orders/order-2014-Apr-12
  2. /home/users/a/admin/commerce/orders/order-2015-Apr-15
  3. /home/users/a/admin/commerce/orders/order-2015-Apr-13

Now i have requirements that order should be in the sorted order as per booked(that i am looking for) , Other is i will have dynamic parameter which will I pass through the method in which i have the XPTH query executed e.g. 6 or ALL . 6 will display the last 6 months order only (that i am looking for). For all orders i can use the above query with sort condition. 

Thanks

 

 

This solved my problem :

1_relativedaterange.property=orderPlaced
1_relativedaterange.lowerBound=-6M
1_relativedaterange.upperBound=0

View solution in original post

2 Replies
vdhim23
Correct answer by
Level 5
Level 5

vdhim23 wrote...

Hi,

I am trying to get all the orders under user. I am using below XPTAH query.

/jcr:root/home/users/a/admin/commerce/orders//element(*)[@orderId] this result below records :

  1. /home/users/a/admin/commerce/orders/order-2014-Apr-12
  2. /home/users/a/admin/commerce/orders/order-2015-Apr-15
  3. /home/users/a/admin/commerce/orders/order-2015-Apr-13

Now i have requirements that order should be in the sorted order as per booked(that i am looking for) , Other is i will have dynamic parameter which will I pass through the method in which i have the XPTH query executed e.g. 6 or ALL . 6 will display the last 6 months order only (that i am looking for). For all orders i can use the above query with sort condition. 

Thanks

 

 

This solved my problem :

1_relativedaterange.property=orderPlaced
1_relativedaterange.lowerBound=-6M
1_relativedaterange.upperBound=0

View solution in original post