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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

To get all WTDocument of Specific type in windchill

SB_10904295
7-Bedrock

To get all WTDocument of Specific type in windchill

Is there way to get all WTDocument of specific type in windchill through code.

ACCEPTED SOLUTION

Accepted Solutions

QuerySpec qs = new QuerySpec(WTDocument.class);
TypeDefinitionReference typeRef = TypedUtilityServiceHelper.service.getTypeDefinitionReference("com.xxx.xxx");//Type
SearchCondition searchType = new SearchCondition(WTDocument.class, WTDocument.TYPE_DEFINITION_REFERENCE + "."+ 
TypeDefinitionReference.KEY + "." + TypeDefinitionForeignKey.BRANCH_ID, SearchCondition.EQUAL,typeRef.getKey().getBranchId());
qs.appendWhere(searchType, new int[] { 0 });
qs.appendAnd();
qs.appendWhere(new SearchCondition(WTDocument.class, WTDocument.LATEST_ITERATION, SearchCondition.IS_TRUE),new int[] { 0 });
QueryResult allDocResult = PersistenceHelper.manager.find((StatementSpec) qs);

View solution in original post

1 REPLY 1

QuerySpec qs = new QuerySpec(WTDocument.class);
TypeDefinitionReference typeRef = TypedUtilityServiceHelper.service.getTypeDefinitionReference("com.xxx.xxx");//Type
SearchCondition searchType = new SearchCondition(WTDocument.class, WTDocument.TYPE_DEFINITION_REFERENCE + "."+ 
TypeDefinitionReference.KEY + "." + TypeDefinitionForeignKey.BRANCH_ID, SearchCondition.EQUAL,typeRef.getKey().getBranchId());
qs.appendWhere(searchType, new int[] { 0 });
qs.appendAnd();
qs.appendWhere(new SearchCondition(WTDocument.class, WTDocument.LATEST_ITERATION, SearchCondition.IS_TRUE),new int[] { 0 });
QueryResult allDocResult = PersistenceHelper.manager.find((StatementSpec) qs);
Announcements

Top Tags