Skip to main content
1-Visitor
June 19, 2020
Solved

Latest revision of each view report

  • June 19, 2020
  • 2 replies
  • 4305 views

We typically use this something like this to get the latest rev either in reports or sql.

"p.versionsortida2versioninfo = (select max (p1.versionsortida2versioninfo) from wcadmin.wtpart p1 where p1.ida3masterreference = p.ida3masterreference)
and p.latestiterationinfo = 1"

Does anyone know how to make this work for each view?  The issue comes up when the view revisions are not the same.  For example "part1 Rev A Design view" and "part1 Rev B Service view" excludes the design view.  Anyone know a trick to getting this to work?

Best answer by joe_morton

Hi,

I've been developing/experimenting with a lot of report templates (not the SQL directly though). I'll try to describe it as best I can.

When you do a max condition, normally you would get just a single result. If you want to get a max for each of something, then that something has to be defined in the main query, and the subselect has a criteria that goes back to the main query. 

So basically in your subquery, you would add a criteria that the view = the view of the WTpart from the main query. That way, you should get a result for the max of each view of each WTPart.

2 replies

joe_morton
18-Opal
18-Opal
June 19, 2020

Hi,

I've been developing/experimenting with a lot of report templates (not the SQL directly though). I'll try to describe it as best I can.

When you do a max condition, normally you would get just a single result. If you want to get a max for each of something, then that something has to be defined in the main query, and the subselect has a criteria that goes back to the main query. 

So basically in your subquery, you would add a criteria that the view = the view of the WTpart from the main query. That way, you should get a result for the max of each view of each WTPart.

1-Visitor
June 19, 2020

That worked great thanks.

7-Bedrock
June 27, 2021

Hello @gscorpil-2 

 

Can you share the sample implementation in QML or SQL format please.

Also, Report Builder Screenshot if you have developed it on Query Builder.

Thank you!

 

 

 

 

 

Marco Tosin
21-Topaz I
21-Topaz I
June 22, 2020

Maybe also this discussion can help other people who read this post.

 

https://community.ptc.com/t5/Windchill/Report-to-list-WTParts-of-particular-view/td-p/96770

 

 

Marco