For XPaths you have the token
See documentation here: https://docs.mendix.com/refguide/xpath#1-overview-of-xpath
Honstely the idea of Mendix is OK.
But if you are familiar with MS Access development, you hit the limits of Mendix in no time.
why is it such a nightmare to run a query against the data base. Everyone knows SQL, where data can be filtered, grouped, calculated, etc.
Just look at the documentation – the constraints is documented OK – and the video helps a bit.
There is no propper documentation for the function, like sum – no video – nothing.
In the time I send figuring out how to do it, I have done the complete project in MS Access.
As I can deduct from you points and status, you haven’t followed the online learning paths and didn’t take the rapid developer exam. Which is 100% your own choice to invest or not to invest that time. But the moment you start comparing Mendix with MS access you do miss a big point. Mendix != Ms Access
Online academy: https://academy.mendix.com/link/home
Next to that, the solution you need doesn’t require an XPath at all. You can nest the 2nd template grid into the context of the service and just connect it using the path directly. This works out of the box, just a few clicks. This is explained in the rapid developer learning path; https://academy.mendix.com/link/path/31/Become-a-Rapid-Developer-(Analyst)