Quantcast
Channel: PTC Community : Discussion List - Windchill
Viewing all articles
Browse latest Browse all 5797

QuerySpec sort EPMDocument iteration as an integer vs as text

$
0
0
Windchill 9.1 M050

I have the following QuerySpec:

String epmNo = "someEPMDocumentNumber";
QuerySpec qs = new QuerySpec(EPMDocument.class);
ClassAttribute number = new ClassAttribute(EPMDocument.class, EPMDocument.NUMBER);
ClassAttribute versionSort = new ClassAttribute(EPMDocument.class,
"versionInfo.identifier.versionSortId");
ClassAttribute iteration = new ClassAttribute(EPMDocument.class,
"iterationInfo.identifier.iterationId");
qs.appendWhere(new SearchCondition(EPMDocument.class, EPMDocument.NUMBER,
SearchCondition.LIKE, epmNo), null);
qs.appendOrderBy(new OrderBy(number, true));
qs.appendOrderBy(new OrderBy(versionSort, true));
qs.appendOrderBy(new OrderBy(iteration, true));
StatementSpec statementSpec = (StatementSpec) qs;
qr = PersistenceHelper.manager.find(statementSpec);

Where I am searching for "someEPMDocumentNumber" and then sorting by the number,
version (versionSortId), and the iteration. This is working like I want except
for the iteration part. This is getting sorted like text so for example on an
revision with 12 iterations I am getting results like this:
Rev.Iteration
A.9
A.8
A.7
A.6
A.5
A.4
A.3
A.2
A.12
A.11
A.10
A.1

When I want it to sort like this:
A.12
A.11
A.10
A.9
A.8
A.7
A.6
A.5
A.4
A.3
A.2
A.1

So how do I define the query to sort the iteration as an integer?

--

Viewing all articles
Browse latest Browse all 5797

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>