Skip to main content
11-Garnet
November 13, 2024
Solved

how query based on soft attribute using queryspec

  • November 13, 2024
  • 3 replies
  • 1846 views

I have a WTDocument substype in that I have made one soft attribute and need to get WTDocument subtype based on the soft attribute value, what have created. How to query based on that soft attribute using queryspec and queryresult through code,

Best answer by avillanueva

IBAs are not supported via QuerySpecs: https://www.ptc.com/en/support/article/CS125877?source=search

But use this method:

https://www.ptc.com/en/support/article/CS169049

 

 

3 replies

HelesicPetr
22-Sapphire II
22-Sapphire II
November 13, 2024

Hi @SB_10904295 

What type is the soft attribute? Is it IBA Global attribute?

You need to be more specific but the solution already exists.

Here is a thread where you can find what you need

Query-spec-for-multiple-objects

PetrH

11-Garnet
November 13, 2024

Hi @HelesicPetr 

Yes, it is a IBA Global attribute.

 

avillanueva
23-Emerald I
23-Emerald I
November 13, 2024
HelesicPetr
22-Sapphire II
22-Sapphire II
November 14, 2024

Hi @avillanueva 

I don't understand why PTC say it is not supported if the querySspec can be used for searching by the IBA

anyway 

very important point for a search objects by IBA by code

it is useful to create a database index on a StringValue table for a value and value2 column because a performance increases by 1000% and more

in my several cases the time was reduced from 6 seconds to 2ms per one call 

PetrH

12-Amethyst
November 13, 2024

You can determine the correct value to use via the logical attribute report page on your windchill server. Plug in your custom type, and a report is generated. Look for the external form, and plug that into the load and get functions in the Java code below.

<Windchill Server URL>/Windchill/netmarkets/jsp/lwcType/logicalAttributeReport.jsp

com.ptc.core.lwc.server.PersistableAdapter persistAdapObj = new com.ptc.core.lwc.server.PersistableAdapter((wt.fc.Persistable) doc, null,java.util.Locale.US, new com.ptc.core.meta.common.SearchOperationIdentifier());	
persistAdapObj.load("IBA|PTC_DD_LANGUAGE");	
String strValue = (String) persistAdapObj.get("IBA|PTC_DD_LANGUAGE").toString();
System.out.println("Attribute Value-"+strValue);

 

12-Amethyst
November 14, 2024

Please ignore this, I misunderstood the question, this thread is about querying based on a soft attribute, not getting it.