How to get the latest revision for all the structure/UsedBy entities
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
How to get the latest revision for all the structure/UsedBy entities
Hi, do anyone have any idea how to get the latest revision for all the structure/UsedBy entities?
I can get the latest revision for the requested part:
Windchill/servlet/odata/v5/ProdMgmt/Parts('<my oid>')?ptc.search.latestversion=true
But how can I get for all the UsedBy entities?
Windchill/servlet/odata/v5/ProdMgmt/Parts('<my oid>')?ptc.search.latestversion=true&%24expand=UsedBy(%24levels%3Dmax)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @SM_12943475,
Thank you for your question.
Your post not yet received any response. I am replying to raise awareness. Hopefully, another community member will be able to help.
Also, feel free to add any additional information you think might be relevant. You could add additional information:
- The exact version of Windchill being used
- If you tried, add the current output of your query to understand what data is being returned.
- If there are any error messages or unexpected results.
It sometimes helps to have screenshots to better understand what you are trying to do.
Regards,
Vivek N
Community Moderation Team
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
To add further, if I didn't add the query 'ptc.search.latestversion=true' in the API request from Postman I get the below response:
API response when ptc.search.latestversion=true is not added
Due to the exceeded response size I need the child level latestversion response. Sometimes while deserializing the json with exceeded response size, the deserialize package throws an unknown exception:
I tried applying the latestversion in $expand query but it throws an exception. It will be helpful to get the latestversion query. Thanks in advance.
Regards,
Sneka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Windchill can only return the last revision where the part is used in. That might not be the latest revision of the assembly.
Example:
Assy1 Revision A:
- Part1
- Part2
Assy1 Revision B:
- Part2
- Part3
If you do Where used for Part1, Windchill will return Assy1 Revision A.
I'm using a workaround for that - expand all the revisions for Where Used parts:
Then I compare the resulting revision with latest revision:
Unfortunately, I'm not sure how to make it work when you expand it for multiple levels ($expand=UsedBy($levels=max))
Kind regards,
Dmitry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @DmitryC
You have to do own logic in the code to be sure to use the latest part.
If you have to check if the latest revision is real latest one, then store this information to a ListMap where you store latest part with number/masterId identification
then go through the structure level by level and check if the part number is in the maplist
if it is in the list get the information from the list if it is not there control the latest version .and again add it to the MapList
This way you can get structure levels with the latest Revisions.
it is just idea but it could work in your app.
PetrH
