Managing the repository : SA Encyclopedia Manager (SAEM) : SAEM menus : Tools menu : Query Builder
  
Query Builder
Query Builder is a powerful interface that makes it easy for you to create custom queries, or to use those supplied with SAEM. The Query Builder is encyclopedia-aware: that is, fields available for you to insert into your query are drawn from the Entity and Relationship tables. The functions, operators, and conditions you can apply to your queries are also specific to System Architect encyclopedias. Whether you choose to run a pre-built query or to build your own, once built, your queries are loaded onto a new query window, from which you can perform regular query functions (for example, save, execute, parse, and so on).
The Query Builder window has two basic components.
Available Queries
This list includes pre-built queries that you can run as is, or use as the basis for customizing your own. Queries that you build and save are added to the drop-down for later use. You can also delete saved queries. Click here to show or hide a list of SAEM’s pre-built queries:
Definition Type Counts
Locked Definitions
Diagram Type Counts
Symbol Type Counts
Class Counts
Relationship Count
Last Activity
Empty Memo Field
Locked Diagrams/Definitions
All Class Ascending
To run a pre-built query
1 Click Tools > Query Builder.
2 Select a query from the Available queries list.
The query is loaded onto the query window.
To add query fields, click the Ellipsis button in front of Select the following fields and select Add a new field.
To add query conditions, click the Ellipsis button in front of the Select records where all of the following apply.
To save changes to a pre-built query, click Save Query.
3 Click OK.
The query is loaded onto the New Query window, where you can perform normal query options, for example: Check, Executes, Save, and so on).
Query Builder
The upper pane is where you add query fields. A row is created for each field, and for each field that you add, you can select a sort order and a function.
The lower pane is where you add query conditions. A row is created for each condition, and for each condition, you can select elementary, advanced elementary, or complex conditions. You can delete individual rows in either the fields or conditions pane.
To create a query with the query builder
1 Click Tools > Query Builder.
2 In the top pane of the Query Builder window, click the ellipsis next to Select the following fields, and then click Add a new field.
3 Click the * link next to Field.
A menu displays fields you can select from the Entity or Relationship tables. Optionally, click the * next to sort or function to insert those values.
4 (Optional.) In the lower pane, click the ellipsis next to Select records where all of the following apply, and then choose an option from the menu.
This sets the number of records to which your condition will apply.
5 (Optional.) Click the ellipsis next to Select records where all of the following apply, and the select a condition from the menu.
6 Click Save Query if you want the query display in the Available Queries list.
Alternatively, you can save your query to a file once your query is loaded to the New Query window (see below).
7 Click OK.
The query is loaded onto a New Query window, where you can perform normal query options (that is, Check, Executes, Save, and so on).