Thank you, Sadok, that got me on the right path. I was misled by old habits; the OS service doesn't allow using a related field in the where clause.
I followed your instructions and was successful. I made a copy of MXAPIWOHIER and added a relationship to WOANCESTOR. (My system already had a relationship called ANCESTORS, but it excluded the top-level work order, ,so I made a new ANCESTOR that didn't.) I specified the query ANCESTOR.ANCESTOR="mywonum" and it fetched the whole hierarchy as desired.
Then for kicks, I tried the same query with the MXWO object, which has no relationship to WOANCESTOR at all and got the same result. I haven't tested further, but is it possible OSLC will follow relationships that aren't defined in the object structure?
------------------------------
Robert Goff
Xanterra Travel Collection
------------------------------
Original Message:
Sent: 02-21-2025 16:26
From: Sadok ABDELLAOUI
Subject: Fetching Work Order Hierarchies with OSLC
Hi Robert,
First, you need to create a custom relationship (Let's name it MY_WOANCESTOR, for example) between the WORKORDER object and the WOANCESOTR object using this where clause (wonum =:wonum and siteid=:siteid). This is because there isn't an out-of-the-box one that satisfies your needs.
Secondly, you need to create a custom object structure with WORKORDER as the main object and WOANCESTOR as its child object and use the MY_WOANCESTOR relationship to link them.
In MxLoader's where clause uses this query: MY_WOANCESTOR.ANCESTOR="mywonum"
Hope it helps
------------------------------
Sadok ABDELLAOUI
Talan
Original Message:
Sent: 02-21-2025 12:26
From: Robert Goff
Subject: Fetching Work Order Hierarchies with OSLC
I'm used to using OS (SQL) query language, but now I'm forced to use the REST interface and OSLC. I cannot seem to figure out how to fetch a work order hierarchy beginning with one work order number. Using SQL, I would have entered the query "wonum in (select wonum from woancestor where ancestor='mywonum')"
This seems like a normal thing to do, but my google-fu is weak and I cannot find examples. Anyone else downloading hierarchies?
------------------------------
Robert Goff
Xanterra Travel Collection
------------------------------