cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

How Do I Query For All IBA Definition References Used In AbstractValue Tables

MatthewKnight
12-Amethyst

How Do I Query For All IBA Definition References Used In AbstractValue Tables

In 9.1, I'm trying to query for instance based attribute defs that are actually assigned to my pbos and I can't get this part of the query right because definitionReference isn't available on the iba value super class (AbstractValue). It is, however, on each and every sub tableexpression.tableClass that the queryspec puts together. Does anybody have any ideas? I don't think I've ever put a CompoundQuerySpec together and used the JOIN SetOperator in WC. Is that the right approach?

Here's a piece from my original query. You can just throw a persistenceserverhelper.query on the end, I guess:

final String DR = StringValue.DEFINITION_REFERENCE; //definitionReference

QuerySpec qs = new QuerySpec();

int valueIndex = qs.appendClassList(AbstractValue.class, false);

qs.appendSelectReference(DR + ".key", valueIndex, false); //Can't remember if this boolean should be true or false. I want to return this attribute.

qs.setDistinct(true); //idk if setDistinct will work for references, but I'm assuming it does.

Anybody have any thoughts or a quick example you can throw together?

1 REPLY 1

I guess I could close the question. I came up with the solution on the 21st or 22nd. I'd say I cheated to get the list of tables, but I didn't want to do the introspection work myself. I created a temporary queryspec against the abstract value class and pulled the child tables/classes off of it's tableexpression. Iterating those, I built identical queryspecs and added them to a CompoundQuerySpec. It's fast and gives me what I want, so it seems like the right approach.

Anybody have another idea to throw out, or maybe just agreement with what I did?

Thanks,

-Matt

Announcements


Top Tags