Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
How to get the specific softType objects of a WTDocument using QuerySpec and SearchCondition api's in windchill 12.1?
Hi @Naga_2000
Same question from another one 😄
This way
QuerySpec querySpec = new QuerySpec();
int idDocObject = querySpec.appendClassList(WTDocument.class, true);
try
{
TypeIdentifier tiCheck = ClientTypedUtility.getTypeIdentifier("wt.doc.WTDocument|cz.in.Agenda");
SearchCondition sc2 = TypedUtility.getSearchCondition(tiCheck, true);
querySpec.appendWhere(sc2, idDocObject);
QueryResult find = PersistenceHelper.manager.find((StatementSpec) querySpec);
while (find.hasMoreElements())
{
Persistable[] nextobj = (Persistable[]) find.nextElement();
WTDocument nextDoc = (WTDocument) nextobj[0];
}
} catch (WTException e)
{
throw new RuntimeException(e);
}
PetrH
Hi @HelesicPetr
The getSearchCondition() method of TypedUtility API is not available in windchill 12.1
TypedUtility.getSearchCondition(tiCheck, true)
It was used in earlier versions i.e; below 12.1.
Naga
Hi @Naga_2000
I really don't know what version of Windchill you use, but in my installation 12.1 the method exists and works. ()
check my debug results
PS: I checked version 12.1.2.2 and the class and method is also there.
PetrH