Skip to main content
16-Pearl
December 19, 2024
Solved

Return top X results from Query Builder report

  • December 19, 2024
  • 2 replies
  • 587 views

Version: Windchill 13.0

 

Use Case: I have a query that can return thousands of results but only need to see the first 10 to 20 based on sort order.


Description:

I can return the top 10 results in TSQL with:
SELECT TOP 10 {column} ... ORDER BY {column} DESC
Can we do this with Query Builder?

Best answer by avillanueva

https://www.ptc.com/en/support/article/CS424612?source=search

Looks like not supported.

2 replies

avillanueva
23-Emerald I
23-Emerald I
December 19, 2024
avillanueva
23-Emerald I
23-Emerald I
December 20, 2024

Hmm, if we had the ability to display the row number, it would be possible to put a condition that shows row numbers less than a value. ROW_NUMBER() or ROWNUM is a function but not one that is listed. I tried using it as a constant and it did not like it. No way to trick it to reading it like pure sql. 

20-Turquoise
December 19, 2024

You might be able to use a custom java class for this:

https://www.ptc.com/en/support/article/CS114482