How to add Max function QuerySpec
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
How to add Max function QuerySpec
Hello,
I trying to create a QuerySpec to retrieve highest branchIditerationInfo (using MAX function) value to get the latest most object
Thanks
Ankit
- Labels:
-
General Customization
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You do something similar to the following:
QuerySpec subSelect = new QuerySpec();
subSelect.setAdvancedQueryEnabled(true);
ClassAttribute versionSortId = new ClassAttribute(WTPart.class, "versionInfo.identifier.versionSortId");
SQLFunction maxFunction = SQLFunction.newSQLFunction(SQLFunction.MAXIMUM, versionSortId);
subSelect.appendSelect(maxFunction, new int[]{wtPartIndex}, false);
This should get you headed in the right direction.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello Ankit,
Windchill help center has nice elaboration about SQLFunction here at
This contains an example of SQLFunction.MINIMUM but it will more or less identical for SQLFunction.MAXIMUM.
I hope this will help you in what you want to achieve.
Regards,
Shirish
