In this blog, let us see how to write a custom query for form object with form attributes.
Create Query in Query Builder
- Queries are searches for objects in the database.
- When you build queries, you specify the kind of objects you are looking for (the class) and characteristics of the objects (attributes).
- In the Query Builder application, click the Search Class button to select the class. You are presented a class tree similar to the Classes view in the Advanced perspective of the Business Modeler IDE.
- When you select a class, its attributes are shown in the Attribute Selection pane.
- Double-click attributes to add them to the query. Click the Display Settings button and choose Real Names to see the attributes with their internal name (not the name displayed in the rich client UI).
- Click create to create the new query. In My Teamcenter, you can run the created query using Advance search option.
Create query for Form Class
- In this example, am write query for OOTB form SchMgtCostForm to search based on form attributes (like object_name). In your case, it will be a custom form.
- Open Query Builder, click the Search type button and search for the form storage. In this example it is SchMgtCostFormStorage. Usually it is <FromRealname>Storage, you can check the storage class name by opening the form in BMIDE.
Form Search |
Form Storage class name |
- The attributes for the class is listed down in Property selection pane. To view all properties from its inherited class select all properties in Display properties panel.
- Double click referenced_by in property panel and find form (SchMgtCostForm) and click Ok.
- Click data_file in Type property selection window.
- Now it will list down all the form attributes from which you can select the required attribute based on which the data is queried in database.
Form attributes |
- Double click on the attributes and in the search criteria pane, change the user entry name or operator or default value. Click Create.
Query |
- Now your query is completed, this query allows to search the form based on object name. Test this by running the query in My Teamcenter.
This will return you the form storage objects. I believe the search class should be form and in data_file you have to give formstorage class and search should be based on properties of storage class.
ReplyDelete