ptc-windchill

How to query WTPart by creator name?


Using the following code:

        QuerySpec qs = new QuerySpec(WTPart.class);
        qs.appendWhere(new SearchCondition(WTPart.class, WTPart.CREATOR_NAME, SearchCondition.EQUAL, name));

Got error

Attribute "creator.name" is not attribute of class "wt.part.WTPart"

I also want to know how to query part by modifier name

Thanks.


Solution

  • If you want to query on modifier name

    long userId=userName.getPersistInfo().getObjectIdentifier().getId();
    QuerySpec qs = new QuerySpec(WTPart.class);
    qs.appendWhere(new SearchCondition(WTPart.class,"iterationInfo.modifier.key.id",SearchCondition.EQUAL,userId), new int[] { 0, 1 });
    

    I'm not sure about query on creator name, i'll check and update this