Skip to main content
3-Newcomer
June 8, 2023
Solved

How to create an API search condition for Organization?

  • June 8, 2023
  • 2 replies
  • 1231 views
I am using Windchill PDMLink Release 12.0 and Datecode with CPS 12.0.0.0

I want to create an api search condition for Organization. In the code below is an api search condition created for Part Number that is using WTPart.Number and I want to develop the same structure for Organization (like 'WTPart.Organization').

QuerySpec querySpec = new QuerySpec(WTPart.class);
SearchCondition sc = new SearchCondition(WTPart.class, WTPart.NUMBER, SearchCondition.EQUAL,partNumber);
querySpec.appendWhere(sc, new int[] { 0,-1});
querySpec.appendAnd();
    Best answer by Fadel
     
    Hi ,
     
     
            int[] fromIndicies = { 0, -1 };
     
            QuerySpec querySpec = new QuerySpec(WTOrganization.class);
            querySpec.appendWhere(new SearchCondition(WTOrganization.class,
                    WTOrganization.NAME, SearchCondition.EQUAL, epmOrg),
                    fromIndicies);
     
           

    2 replies

    Fadel
    Fadel23-Emerald IIAnswer
    23-Emerald II
    June 8, 2023
     
    Hi ,
     
     
            int[] fromIndicies = { 0, -1 };
     
            QuerySpec querySpec = new QuerySpec(WTOrganization.class);
            querySpec.appendWhere(new SearchCondition(WTOrganization.class,
                    WTOrganization.NAME, SearchCondition.EQUAL, epmOrg),
                    fromIndicies);
     
           
    Buiꓘa
    3-Newcomer
    June 8, 2023

    It's working. Thank you!