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
4-Participant
June 27, 2025

Hi avillanueva,
I have one requirement i want to query on Product id IBA which is on Product for comparison or uniqueness so can we query for all the values of that IBA which are stored in DB so i can get the stored values and i cam check if new product ID exist then do not create Product with same or throw runtime error .
I am looking for queryspec .

Thanks

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.