Skip to main content
1-Visitor
March 20, 2013
Question

How to search EPMDocument in folder or container using WC APIs

  • March 20, 2013
  • 1 reply
  • 6766 views

I want to search all EPMDocuments in a folder or container using Windchill API (QuerySpec). I do not want to use webjects. How can I do it?

1 reply

1-Visitor
March 20, 2013

I want to search All EPMDocuments under a folder. Query should take Folder path or container name as input and output should list all EPDocumets under that folder.

1-Visitor
April 19, 2013

Hi Amit,

QuerySpec querySpec2 = new QuerySpec(EPMDocument.class);

/*SearchCondition condition = new SearchCondition(ContainerTeam.class,ContainerTeam.NAME, SearchCondition.LIKE,"%Sample_Product_02");

querySpec2.appendWhere(condition);*/

QueryResult queryResult2 = PersistenceServerHelper.manager.query(querySpec2);

while (queryResult2.hasMoreElements()) {

EPMDocument epmDocument = (EPMDocument) queryResult2.nextElement();

System.out.println("Part Name : "+ epmDocument.getCADName());

}

it only takes all the cad names (EPM Document).

but i cant able to fullfill your requirement.

Thank you

Vijayan

12-Amethyst
April 26, 2013

Hi,

Try this may be it'll help

QuerySpec qss = new QuerySpec(EPMDocument.class);

EPMDocument doc = null;

qss.appendWhere(new SearchCondition(EPMDocument.class,EPMDocument.CONTAINER_NAME,SearchCondition.EQUAL,"<your container name>"),new int[] { 0 });

qss.appendAnd();

qss.appendWhere(new SearchCondition(EPMDocument.class,EPMDocument.FOLDER_PATH,SearchCondition.EQUAL,"<your folder path>"),new int[] { 0 });

QueryResult qrr = PersistenceHelper.manager.find((StatementSpec)qss);

while(qrr.hasMoreElements())

{

doc = (EPMDocument)qrr.nextElement();

}

Message was edited by: kaushik das