cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Cannot return search results of latest version of WTPart

brian_beard
1-Visitor

Cannot return search results of latest version of WTPart

Hello,

I have created a query within Query Builder that allows me to put a begin date and end date and for the period, the search results will show me WTParts. There is one problem, however. The search results should only return the latest version of a part.

Rather than the search results show A.1, A.2, A.3, B.1, and B.2; the search results shouldy on show B.2 of that part because it is the latest version.

Does anyone know how to accomplish this using the attributes available within the Query Builder interface or is this something that is going to require some custom code?

Thank in advance for any insight you may be able to provide.

7 REPLIES 7

Criteria, Latest, value (constant) = 1

The only thing I see in the Part (wt.part.WTPart) class is the "Latest Iteration" attribute. I do not see just a "Latest" attribute. Could you describe in more detail whether or not the "Latest" attribute that you are telling me about is available in this class or another class?

Thanks in advance.

Also, I should mention that I am currently leveraging the "Latest Iteration" attribute which will return results of the latest iteration of a part as the name implies. The problem with this is that the same part could have multiple rows or instances within the search. For example, part number 0001 may have search results 3 times, one for the most current iteration of each revision. See below.

<u>Number | Version </u>

0001 | A.4

0001 |B.5

0001 |C.3

The only thing that should show up in this case would be part number 0001 version C.3 because it is the most current version.

0001 | A.4

Please disregard the extra "0001 |A.4" at the bottom of my last reply. That was a mistake.
LiuLiang
4-Participant
(To:brian_beard)

Most of our part reports require to list only the part(s) with latest iteration on its latest revision.

I haven't found a better way to find latest revision than listing the part with the maximum value of versionSortID against the same master.

I have attached my sample report on how we query it currently. I would like to see if other users have better way to achieve this goal. Thanks.

In Reply to Brian Beard:

Please disregard the extra "0001 |A.4" at the bottom of my last reply. That was a mistake.


That solutionlooks better than mine.

I was doing a NOT EXISTS other where other.versionSortID>current.versionSortID

I guess I'm going to use the maximum function in the future.

Thanks,

In Reply to Liu Liang:

Most of our part reports require to list only the part(s) with latest iteration on its latest revision.

I haven't found a better way to find latest revision than listing the part with the maximum value of versionSortID against the same master.

I have attached my sample report on how we query it currently. I would like to see if other users have better way to achieve this goal. Thanks.

In Reply to Brian Beard:

Please disregard the extra "0001 |A.4" at the bottom of my last reply. That was a mistake.

For the future, here is some information if anyone runs into the situation we have. Since the Design view of parts in classified and not our other views, we needed to show the latest version whereview = "Design". I built upon the query that was posted so I came up with something like this that returns the latest version of the design view of a part.

<u>Criteria</u>:

Part (wt.part.WTPart).versionInfo.identifier.versionSortId

IN

Sub-select

<u>Sub-select</u>:

- From:

  • Part (wt.part.WTPart)
    • Alias: Part (wt.part.WTPart) 1
  • View
    • Alias: View 1

- Join:

  • Part (wt.part.WTPart) 1 to View 1
  • Association: View

- Select:

  • MAX function of Part (wt.part.WTPart) 1.versionInfo.identifier.versionSortId

- Criteria:

  • AND
  • View 1.Name = Design
  • AND
  • Part (wt.part.WTPart) 1.Master Reference.Object Id.Id = Part (wt.part.WTPart).Master Reference.Object Id.Id
Announcements


Top Tags