Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
10 views38 pages

Query Builder - V0.1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views38 pages

Query Builder - V0.1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

Query Builder

E-PLM Team
7/10/2024
Contents

• What is Query Builder ?


• Query Builder Interface
• Basic Concept for using Query Builder
• Creating Query
• Managing Queries
• Search Criteria Clause
• Importing Query Definition
• Exporting Query Definition
• Best Practices

2 7/10/2024 © KPIT Technologies Limited


What is Query Builder ?

Teamcenter application that enables a system administrator to create and maintain customized searches for objects
in the Teamcenter databases, both local and remote.

Saved queries are subject to standard object protection and can be accessed by users through the search feature in
My Teamcenter.

POM (persistent object manager) schema:-


Is an hierarchical arrangement of classes, subclasses, and attributes.

Query definitions:-
Also called saved queries, identify search criteria used to find information in Teamcenter.

3 7/10/2024 © KPIT Technologies Limited


Query Builder Interface
1 --> Saved Queries Tree Pane
2 --> Saved Queries Properties Pane
3 --> Localization Button
4 --> Search Class Button
5 --> Attribute Selection Pane
6 --> Search Criteria Pane

4 7/10/2024 © KPIT Technologies Limited


Query Builder Interface
Saved Query Tree Pane
The Saved Queries tree pane displays
all saved queries in the database

5 7/10/2024 © KPIT Technologies Limited


Query Builder Interface
Saved Query Properties Pane
When you select a saved query in the
tree, the details are displayed in
properties pane.
- Name,
- Description,
- Query type, and
- Search Class

You can modify these properties and


then create or modify a saved query.

You can delete the selected saved


query.

Localization Button
Clicking the Localization button displays
the Language Translations dialog box
that lists existing translation values.

6 7/10/2024 © KPIT Technologies Limited


Saved Query Properties Pane
Query Builder Interface
Search Class Button
Displays the Class/Attribute Selection dialog
box that lists the query classes for selection.

On clicking on this button you are allowed


to navigate and search the Teamcenter POM
schema and select classes and attributes for
use in query definitions.

7 7/10/2024 © KPIT Technologies Limited


Query Builder Interface

Attribute Selection Pane


The Attribute Selection pane displays the
attributes of the selected class.
- Either all Inherited Class Attributes, or
- Only the Direct Attributes of the Class.

8 7/10/2024 © KPIT Technologies Limited


Query Builder Interface
Attribute Selection Pane

9 7/10/2024 © KPIT Technologies Limited


Query Builder Interface
Search Criteria Pane
When you perform your search, Teamcenter
examines the attribute specified in each of
your search clauses and looks for values that
match your search.

Following are the search criteria elements:


- Boolean Rules
- Attributes
- User Entry L10N Key
- User Entry Name
- Logical Operators
- Default Value

10 7/10/2024 © KPIT Technologies Limited


Query Builder Interface
Boolean Rules
The Boolean rules (AND/OR) are used to
combine clauses to create a custom query.

When you use AND clauses together, both


must be satisfied to return a match

When you use OR clauses together, either


can be satisfied to return a match

Attributes
The selected database attribute displays in
this box

User Entry L10N Key


Specifies the localization key used to look up
user entry names.
The localization key-value pairs are defined in
the qry_user_entry_names_locale.xml file.

11 7/10/2024 © KPIT Technologies Limited


Query Builder Interface
User Entry Name
Displays the query box names as they
appear in the search form.

If the key-value pair is not defined in the


qry_user_entry_names_locale.xml file, the
user entry name is the same as the key
entered in the User Entry L10N
Key column.

Logical Operators

12 7/10/2024 © KPIT Technologies Limited


Query Builder Interface
Default Value
Default values can be entered as a text
string or selected from the associated list of
values.

This box is required only when you do not


specify the user entry name, unless the
logical operator IS_NULL or IS_NOT_NULL
is used.

The following keyword variables can be


used to display default values in the query
form:
• $USERID
• $USERNAME
• $GROUP
• $TODAY

13 7/10/2024 © KPIT Technologies Limited


Query Builder Interface
Order By tab
Following are the search criteria elements:
- Attributes
- User Entry L10N Key
- User Entry Name
- Order by

14 7/10/2024 © KPIT Technologies Limited


Basic Concepts for using Query Builder
User can use an existing query from the saved queries tree.
Saved queries are accessed by users through the search feature in My Teamcenter.

We can also use Query Builder to create queries based on the following features:
• Queries using the hints feature
• Queries that include a keyword search
• Queries based on an existing definition
• Queries using the IS_NULL or IS_NOT_NULL operators

Basic Task Using Query Builder:

• Create customized searches for objects in both local and remote Teamcenter databases.
• Export query definitions saved as XML files, which can be shared with other Teamcenter sites.
• Import into Teamcenter query definitions saved as XML files.

15 7/10/2024 © KPIT Technologies Limited


Creating Query
1. Click the Clear button to remove existing
information from the Query Builder boxes.

2. In the Name box, type a unique name for


the query.

3. Optionally, type a description of the query


in the Description box.

4. Select Local Query from the Modifiable


Query Types list.

5. Click the Search Class button


The Class/Attribute Selection dialog box
appears

6. Specify the
desired search class
by selecting an entry
from this dialog box.
16 7/10/2024 © KPIT Technologies Limited
Creating Query
7. To display the search results in an
indented or hierarchical form, select Show
Indented Results.

8. Double-click to select at least one of the


attributes in the Attribute Selection tree

9. Result : The attribute is added to the


Search Criteria table.

10. Specify the desired search criteria. You


must specify the following required
search criteria boxes:
• Attribute
• User Entry L10N Key
• Logical operators

11. Click the Create button to save the


query definition.

17 7/10/2024 © KPIT Technologies Limited


Creating Query – Using the Hint Feature
Query hints are provided to assist you in navigating the schema by presenting a relationship to traverse (for
example, item-to-item master form) and the steps required to build that relationship into your query definition.

1. In the Name box, type a unique name for


the query.

2. Optionally, type a description of the


query in the Description box.

3. Select Local Query from the Modifiable


Query Types list.

4. Click the Show Hints button in the saved


query properties pane.

The system displays the hints pane.

18 7/10/2024 © KPIT Technologies Limited


Creating Query – Using the Hint Feature
5. Click the Choose Hint button located at the top of the hint pane.

The system displays the choose hint pane containing the directory of query hints.

6. Expand the Item Queries folder, select Item to Item Master Form, and click OK

The dialog box closes and the system displays the selected hint in the hint pane.
The first entry in the hint is the base class, followed by the traversal steps,
Ending with the attribute of the item master form class that is added to the query clause.

7. Select the base class by clicking the Search Class button

The system displays the Class/Attribute Selection dialog box

8. The system displays the item class and its attributes in the
Attribute Selection area, and the Find in Tree and Add Clause to
Table buttons are available in the hint pane

9. The Item to Item Master Form hint traverses the schema to the project_id attribute from the Item
Master Form. To add this attribute to the query definition, click the Add Clause to Table button.
19 7/10/2024 © KPIT Technologies Limited
Creating Query – Using the Hint Feature
10. If you want to search for project_id attribute of the Item Master Form, click the Find in Tree button.

11. The system expands the tree in the Attribute Selection pane to display the Project ID attribute.

12. Double-click any of the other attributes to add them to the clause table.

You can use other hints to add more clauses to the query table by selecting a new hint and repeating the previous
steps.

Modify the search criteria and clause precedence, as required

13. Click the Create button to save the query definition.

20 7/10/2024 © KPIT Technologies Limited


Creating Query – that include “keyword” search
Including the keywords attribute in a query definition allows you to develop queries to find dataset files that
contain a specific keyword or combinations of keywords.
1. In the Name box, type a unique name for
the query.

2. Optionally, type a description of the


query in the Description box.

3. Select Keyword Search Query from the


Modifiable Query Types list.

4. Click the Search Class button


to select the target class for the query

The Class
Selection dialog
box displays the
POM schema in
tree format.

21 7/10/2024 © KPIT Technologies Limited


Creating Query – that include “keyword” search
5. Expand the POM_application_object class and locate the WorkspaceObject class.
Expand the WorkspaceObject class, and then double-click the Dataset class.

The system displays the Dataset class on the Search Class button, and the Dataset class and its attributes are
displayed in the Attribute Selection pane.

6. Add the Keywords attribute to the Search Criteria table by either double-clicking the attribute in the tree or by
selecting it in the tree and clicking the Add button.

7. The system displays the attribute (tc_fts_keyword) and default operator (=) in the table.

8. Optionally, modify the default operator and default attribute value.

9. Optionally, add other search clauses to the table.

10. Click the Create button

The system adds the query to the saved queries tree. The query form is also available in the System Defined
Searches list in My Teamcenter
22 7/10/2024 © KPIT Technologies Limited
Creating Query – based on “existing definition”
1. Select an existing query from the saved
queries tree.

2. In the Name box, type a unique name


for the query.

3. Change the information in the


Description box, Search Class box,
and/or Search Criteria table columns.

4. Click the Create button

The system adds the query to the saved


queries tree. The query form is also
available in the System Defined Searches
list in My Teamcenter.

23 7/10/2024 © KPIT Technologies Limited


Creating Query – using “IS_NULL or IS_NOT_NULL operator”
The IS_NULL and IS_NOT_NULL operators
allow you to create queries to find
objects with null attribute values.

Clauses that use this operator are treated


as having a fixed value;
therefore, there is no need to enter a name
and default value for the clause.

1. In the Name box, type a unique name


for the query.

2. Optionally, type a description of the


query in the Description box.

3. Select Local Query from the


Modifiable Query Types list

24 7/10/2024 © KPIT Technologies Limited


Creating Query – using “IS_NULL or IS_NOT_NULL operator”
4. Click the Search Class button to
select the target class for the query.

The Class Selection dialog box displays the


POM schema in tree format.

5. Expand the
POM_application_object
class and locate the
WorkspaceObject class.

6. Expand the
WorkspaceObject class and
select the ItemRevision class by selecting it
and closing the dialog box.

ItemRevision is now displayed on the Search


Class button, and the ItemRevision class and
its attributes are displayed in the Attribute
Selection pane.
25 7/10/2024 © KPIT Technologies Limited
Creating Query – using “IS_NULL or IS_NOT_NULL operator”

7. Click the Display Settings button and select All Attributes.


Add the Release Status attribute to the Search Criteria table by selecting it in the tree and clicking the Add
button .

The attribute and default operator (IS_NULL) are displayed in the table.

8. Change the operator from IS_NULL to IS_NOT_NULL by clicking the right corner of the operator cell and
selecting IS_NOT_NULL from the list.

9. Click the Create button to create the query.

The system adds the query to the saved queries tree. The query form is also available in the System Defined
Searches list in My Teamcenter.

26 7/10/2024 © KPIT Technologies Limited


Managing Queries
You can manage queries by either modifying them or deleting them.

Modify a query

1. Select a query from the saved queries tree.


Information about that query is displayed in the boxes on the right side of the window.

2. Change the information in the Name, Description, or Search Class box, and/or Search Criteria table columns.

3. Click Modify to save your changes in the database.

Delete a query

1. Select a query from the saved queries tree.

2. Click Delete. Teamcenter displays the Delete Confirmation dialog box.

3. Click Yes to delete the query from the database and remove it from the saved queries tree.
27 7/10/2024 © KPIT Technologies Limited
Search Criteria Clause
Search criteria is specified using statements or clauses in the Search Criteria table.

✓ Each clause searches the class and examines a specific attribute in that class and each clause can examine only
one attribute
Therefore, if you want to build a complex query that examines multiple attributes, you must build several search
clauses (one for each attribute you want to examine).

✓ When you perform your search (run your query), Teamcenter examines the attribute specified in each of your
search clauses and looks for values that match your search criteria.

✓ The Search Criteria pane defines the elements in the Search Criteria table.

The Search Criteria table example finds users that meet the person name and user
ID criteria values entered by the user.

28 7/10/2024 © KPIT Technologies Limited


Search Criteria Clause
The combination of the User Entry L10N Key and Default Value elements dictate how the search criteria is
presented to the user

✓ The User Entry L10N Key has a value and the Default Value is blank.
Result: The attribute displays in the saved query for the user to populate.

✓ The User Entry L10N Key has a value and the Default Value has a value.
Result: The attribute displays in the saved query with the default value. The user can change the default
value in the saved query pane.

✓ The User Entry L10N Key is blank and the Default Value has a value.
Result: The attribute does not display in the saved query. The value is evaluated in the query.
When the User Entry L10N Key is blank, the Default Value must have a value.

29 7/10/2024 © KPIT Technologies Limited


Search Criteria Clause – An Example
Saved query: Admin – Object Ownership
Search class: WorkspaceObject

✓ The user ID of the owning user of the WorkspaceObject is the user logged on and executing the query.
Result: The attribute displays the user ID of the current user in the saved query. The query looks for
workspace objects owned by the value of the user ID.

✓ The name of the owning group of the WorkspaceObject is the current group of the user logged on and executing
the query.
Result: The attribute displays the group name of the current user in the saved query. The query looks for
workspace objects owned by the value of the group name.

✓ The object type of WorkspaceObject is ItemRevision.


Result: The attribute displays ItemRevision in the saved query. The query looks for workspace objects with
a type that matches the value of type.

30 7/10/2024 © KPIT Technologies Limited


Search Criteria Clause
Assign precedence to clauses

1. Select the clause or clauses that you want to move up or down in the list.

2. Click the Gain Precedence button to move the clauses up or click the Lose Precedence button to
move the clauses down.

3. Continue clicking the buttons until the clauses are moved to the position you want.

Remove clauses from the table

1. Select the clause or clauses that you want to remove from the list.

2. Click the Remove Search Clause button.


The selected clauses are removed from the list.
Creation or modification is not committed to the database until you click Create or Modify, respectively.

31 7/10/2024 © KPIT Technologies Limited


Importing Query Definition
Perform the following steps to import a query definition from an XML file & create the corresponding query in the TcUA db:

1. Click the Import button in the Query Builder dialog box.


The system displays the Import dialog box. The last query definition file that was imported to TcUA is displayed.

2. Click the Browse button to locate the XML file containing the definition you want to import.
The system displays the Read Query Definition dialog box.

3. Locate the XML file and click the Import button.


The system displays the contents of the XML file in the Import dialog box.

4. Click the Verify button.


If the file format is valid, the query data is displayed in the Query Builder pane. If parser errors are encountered, an informational
message describing the nature of the errors is displayed.

5. Click OK to load the query in the saved query tree and dismiss the Import dialog box.

6. Optionally, modify the name, description, or query clauses.

7. Click the Create button .


The system verifies that the definition is compatible with the local database schema. If so, the query is saved in the database. If not,
an error message describes the discrepancies.

32 7/10/2024 © KPIT Technologies Limited


Exporting Query Definition
Perform the following steps to export a query definition to an XML file:

1. Select the query in the saved queries tree that you want to export.
The system displays the query definition in the right pane of the Query Builder pane.

2. Click the Export button.


The system displays the query, in XML format, in the Print dialog box.

3. Click the Save button to save the definition to a user-specified file.


The system displays the Save dialog box.

4. Determine the directory to which the file is saved.

5. Type a name in the File name box, including the .xml file extension.

6. Click the Save button .


The system saves the file to the specified location and closes the Save dialog box.

7. Click the Close button in the Print dialog box.

33 7/10/2024 © KPIT Technologies Limited


Best Practices
Restore My Saved Searches folder
If you mistakenly delete your My Saved Searches folder, you can restore your saved searches.
The following steps illustrate the process for creating a query to restore the contents of your My Saved Searches
folder.

1. In the Name box, type a unique name for the query.


2. (Optional) Type a description of the query in the Description box.
3. Click the Search Class button to select the target class for the query.
The Class Selection dialog box displays the POM schema in tree format.
4. Expand the POM_application_object class and locate the SavedSearch class.
5. In the Attribute Selection pane, click the Display Settings button. From the
Display Settings dialog box, select All Attributes and Display Names.
6. Select the Owner subclass by double-clicking the node in the tree.
The Attribute Selection pane displays the Owner [User] attribute and its
attributes of the SavedSearch class.
7. In the Search Criteria pane, specify the following search criteria:
• Name
• Description
• Type
8. Click the Create button to create the query.
The system restores the saved queries tree.
34 7/10/2024 © KPIT Technologies Limited
Best Practices
Export saved searches to another Teamcenter installation

1. Export the saved query to a directory of your choice:


a. Select the saved query from the Saved Queries tree pane.

b. Click the Export button.


The file is displayed in XML format in the Print dialog window.

c. From the Print dialog window, click the Save button to save the definition to a user-specified file.

2. To import the saved query to a new Teamcenter installation:


a. Open Query Builder from the new Teamcenter installation and click the Import button.

b. Select the saved query file to be imported and click Verify and then OK.

c. When the file is displayed, click the Create button to create the query.

35 7/10/2024 © KPIT Technologies Limited


36 7/10/2024 © KPIT Technologies Limited
Questions

37 7/10/2024 © KPIT Technologies Limited


Thank You

www.kpit.com

38 7/10/2024 © KPIT Technologies Limited

You might also like