Advanced Customization > Business Logic Customization > Customizing the Product Structure Explorer (PSE) > Customizing PSE Structure Queries
  
Customizing PSE Structure Queries
Objective
You want to customize the PSE New Query dialog to include subtypes of WTPart and allow queries to be created referencing reusable attributes of the subtype.
Background
The dialog launched from the View->Query->New Query menu entry allows the user to construct a query that will locate objects in the structure that match the specified criteria. The out-of-the-box configuration allows specific attributes of WTPart to be queried.
Customers will create their own subtypes of WTPart with their own attributes. In order to allow these to be used in the query, customization of the PSE XML files is required.
Scope/Applicability/Assumptions
As these changes are being made to the PSE XML files, they will apply to all users of PSE.
Intended Outcome
You may want to include the soft WTPart “myPart” in the searchable Types, and allow the attributes “myCost” and “myDescription” to be queried. As “End Item”, “Generic” and “Reference Designator” are not relevant to this type, these are removed from the Property drop-down.
Solution
Add the appropriate element group in
<Windchill>/codebase/config/logicrepository/xml/explorer/structure
explorer/ExplorerSearchableTypes.xml
The element group will define CellDefinitions (both additions and removals) for the AttributeGroup with id="ptc.wnc.exp.QuerySearchableAttrs " for the “myPart” type.
Prerequisite knowledge
To achieve this objective, you need to have an understanding of the following:
The management of XML file customizations
Solution Elements
Element
Type
Description
ExplorerSearcha bleTypes.xml
XML file
Holds the definition of types and attributes that will be exposed in the New Query dialog.
Located in:
<Windchill>/codebase/config/logicrepositor
y/xml/structureexplore
LogicContext
XML element
Specifies the application and data type that the definition is to be applied
AttributeGroup
XML element
PSE locates all the attribute groups with id ptc.wnc.exp.QuerySearchableAttres, and uses the type inheritance to find all the properties (CellDefinitions) that will be displayed.
CellDefinition
XML element
The id of the property that will appear.
Placement remove=”true”
XML element
Remove=true is used to stop a property from appearing due to inheritance.
Procedure
Edit the file ExplorerSearchableTypes.xml, before the final line </LogicRepository> insert the following lines:
<!-- New Query definition for subtype myPart -->
<ExplorerElementGroup>
<LogicContext application="ptc.wnc.StructureExplorer"
dataType="com.aprilia.www.myPart"/>
<AttributeGroup id="ptc.wnc.exp.QuerySearchableAttrs" displayMode="view">
<!-- Remove the following that would otherwise be inherited from WTPart
Definition -->
<CellDefinition id="endItem">
<Placement remove="true"/>
</CellDefinition>
<CellDefinition id="genericType”>
<Placement remove="true"/>
</CellDefinition>
<CellDefinition id="referenceDesignator">
<Placement remove="true"/>
</CellDefinition>
<!-- Add the specific attributes of myPart -->
<CellDefinition id="myCost">
<AttributeDefinition attributeId="com.aprilia.www.myCost"/>
</CellDefinition>
<CellDefinition id="myDescription">
<AttributeDefinition attributeId="com.aprilia.www.myDescription"/>
</CellDefinition>
</AttributeGroup>
</ExplorerElementGroup>
After the method server is restarted, this results in “myPart” appearing in the Type drop-down, with Property entries “End Item”, “Generic” and “Reference Designator removed, and “myCost” and “myDescription” added, as shown in Section Intended Outcome.
Alternatively, if the changes are to be made to other aspects of the PSE UI via XML customization, these additional lines can be added to an XML file that holds all the “myPart” customization.
Customization Points
It is valid to remove the WTPart definition from ExplorerSearchableTypes.xml, so Part does not appear in the type drop-down. However, no definitions of the properties will be inherited by the subtype definitions, so these will have to be added.