Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Is there way to get all WTDocument of specific type in windchill through code.
Solved! Go to Solution.
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);
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);