Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Hello All,
I trying to write a Query report to list all the values of Classification Attributes for all the WTParts. I followed PTC solution CS220979, I'm only getting the Attribute Names of all the WTParts. The values of the Attributes are not generated. Is there something I'm missing to add in the query?
Any suggestions would be helpful.
Thanks,
Kiran
You should join this group Reporting and also read this article Resource for reporting
In the document there are lots of report ready to use and I think you can find what you're looking for.
Marco
Link not accessible.
1. You can fetch the classification node on a WTPart by simply fetching the IBA value of classification attribute. Below snippet can be used to fetch the internal name of classification node:
String node = getibaValue( <WTPart Object>, <Internal name of Classification Binding attribute>);
public static String getibaValue(Persistable obj, String id) {
try {
// fetching persistable object
final PersistableAdapter obj2 = new PersistableAdapter(obj, null,
Locale.US, null);
obj2.load(id);
String value = obj2.getAsString(id).toString();
return value;
} catch (WTException e) {
// return - if exception
return "";
}
}
2. Now we need to fetch all the classification attributes corresponding to the internal name of node which we have fetched in step 1. Below code snippet returns a list with all classification attributes.
public static List<String> getPartsLinkIBA(String node)
throws WTException {
List<String> l1 = new ArrayList<String>();
final TypeDefinitionReadView localTypeDefinitionReadView = TypeDefinitionServiceHelper.service
.getTypeDefView(AttributeTemplateFlavor.LWCSTRUCT,
CsmConstants.NAMESPACE, node);
if (localTypeDefinitionReadView != null) {
final Collection<AttributeDefinitionReadView> x = localTypeDefinitionReadView
final Iterator<AttributeDefinitionReadView> it = x.iterator();
// getting all the attributes internal name
while (it.hasNext()) {
final Object object = (Object) it.next();
final AttributeDefinitionReadView adrv = (AttributeDefinitionReadView) object;
l1.add(adrv.getName());
/*
return l1;
}
3. Once you have the WTPart Object and all the classification attributes (List in step 2), you can fetch the values of all the attributes by using any method like Persistable Adapter, IBAHolder, etc.