Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Translate the entire conversation x

How to get the latest revision for all the structure/UsedBy entities

SM_12943475
3-Newcomer

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)

3 REPLIES 3

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:

 

  1. The exact version of Windchill being used
  2. If you tried, add the current output of your query to understand what data is being returned.
  3. 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

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 addedAPI 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:

SM_12943475_1-1741178106493.png


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

 

 

DmitryC
14-Alexandrite
(To:SM_12943475)

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:

https://windchill.server/Windchill/servlet/odata/ProdMgmt/Parts('OR:wt.part.WTPart:123456789')/UsedBy?$select=Number,State,Revision,Name&$orderby=Number%20asc,Revision%20desc&ptc.search.latestversion=true&$expand=UsedBy($select=Number,State,Revision,Name),Revisions($select=Number,State,Revision)

 

Then I compare the resulting revision with latest revision:

DmitryC_1-1741228276607.png

 

Unfortunately, I'm not sure how to make it work when you expand it for multiple levels ($expand=UsedBy($levels=max))

 

Kind regards,

Dmitry

Announcements


Top Tags