Quantcast
Channel: PTC Community: Message List - Windchill
Viewing all articles
Browse latest Browse all 8876

How to find objects by boolean attribute value?

$
0
0

Hi.

I defined soft type of WTPart that has global boolean attribute.

I need to find this soft type instances having the attribute=true.

I tried to use code:

 

long wtPartSoftTypeId;

long globalBooleanAttrId;

 

QuerySpec querySpec = new QuerySpec(WTPart.class);

 

int attributeIndex = querySpec.appendClassList(BooleanValue.class, false);

int attrIndices[] = {0, attributeIndex};

 

querySpec.appendWhere(new SearchCondition(WTPart.class, "thePersistInfo.theObjectIdentifier.id", BooleanValue.class, "theIBAHolderReference.key.id"), attrIndices);

querySpec.appendAnd();

querySpec.appendWhere(new SearchCondition(BooleanValue.class, "definitionReference.key.id", SearchCondition.EQUAL, globalBooleanAttrId), new int[]{attributeIndex});

querySpec.appendAnd();

querySpec.appendWhere(new SearchCondition(BooleanValue.class, BooleanValue.VALUE, SearchCondition.EQUAL, true), new int[]{attributeIndex});

querySpec.appendAnd();

 

CompositeWhereExpression where = new CompositeWhereExpression(LogicalOperator.AND);

where.append(new SearchCondition(WTPart.class, "typeDefinitionReference.key.branchId", SearchCondition.EQUAL, wtPartSoftTypeId), new int[] {0});

querySpec.appendWhere(where, new int[]{0});

 

QueryResult queryResult = PersistenceHelper.manager.find((StatementSpec) querySpec);

 

result query spec looks like:

SELECT A0.*

FROM wt.part.WTPart A0,wt.iba.value.BooleanValue A1

WHERE (A0.idA2A2 = A1.idA3A4) AND (A1.idA3A6 = 289061) AND (A1.value = N'?') AND ((A0.branchIdA2typeDefinitionRefe = 189491))

joins=null

useBind=true [289061, ?, 189491]

 

 

And i have an error: A persistence error occurred

 

The similar code for StringValue attribute works fine.

Can anyone help me?


Viewing all articles
Browse latest Browse all 8876

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>