7.6.3.1 Working with the SQL Tool
The SQL Tool is found in the Simulator when in Database storage view. The Storage views are explained further in Section 7.6. To start the tool, press the SQL Tool icon
. When started, the user is asked to choose a saved Simulation set to base the search on, see Figure 110. When a set is chosen the SQL Tool window is opened. The main window is explained in Figure 111 and Table 65 below.
| Section | Component | Description |
|---|---|---|
| 1 | Tabbed panel | The function tabs. Available tabs are Query builder and Query writer. |
| 2 | Label | Presents the number of found simulation cases. |
| 3 | Close-button | Closes the SQL tool. |
| 4 | Create simulation set-button | Creates a simulation set in the Simulator and inserts the simulation cases in the result from the last executed query. |
| 5 | Execute-button | Executes the currently configured query. |
The SQL Tool consists of a main window with two tabs: Query Builder and Query Writer. The tabs represent the two functions of the tool:
The Query Builder
The Query builder enables composing any number of search criteria, here called conditions, to use when fetching test cases from the database. A condition is always based on the content of one of the data fields in the simulation cases.
- Note:
- It is not possible to use a data field that belongs to a context in the search.
The Query builder tab is selected when the SQL Tool is opened. Initially there are no conditions configured. Figure 112 and Table 66 explains the basic parts of the Query builder.
| Section | Component | Description |
|---|---|---|
| 1 | Combo box | Combo box for choosing if the conditions in the list should be set up with “OR” or “AND” in the query. |
| 2 | List | The list with the configured conditions. |
| 3 | List item | A configured condition. |
| 4 | Label | The name of the data field of this condition. |
| 5 | Operator-combo box | Combo box with the available operators for this condition. |
| 6 | Depends on the data field connected to the condition | The parameter input component for this condition. |
| 7 | Add/remove condition button | Opens the Selection tool for adding and removing conditions. |
To add a condition, press the button Add/remove condition. The selection tool, see Figure 113, is shown. In this tool the available data fields are shown in a table. Click to check the check box to the left of the wanted data field to add it to the condition list. To remove a data field, click to clear the check box to the left of it. An additional feature in the selection tool is the Search text field that is used to filter the data fields in the table. By typing a part of the name of a wanted data field, the table is updated to show only the data fields that match the text string in the Search text field.
The condition list in the SQL Tool is concurrently updated with the choices made in the selection tool.
The chosen data fields are now shown in the Query builder window as rows in the condition list. Conditions can be configured to represent the wanted search criteria. This is done by choosing an operator and a parameter. Available operators depend on the configuration of the chosen data field. Table 67 below explains the operators.
| Field data type | Available operators |
|---|---|
| Boolean, Date, Time, OctetString | Equals – an exact match with the parameter. |
| String, BcdString | Begins with – matching the string with the beginning of the data field value. End with – matching the string with the end of the data field value. Contains – matching any occurrence of the string. Exact match – an exact match with the string. |
| Numeric data type | >, bigger than the parameter. <, less than the parameter. >=, bigger than or equals to the parameter. <=, less than or equals to the parameter. =, equals to the parameter. !=, not equals to the parameter. |
The format of the parameter is also dependent on the chosen data field. For example, if a boolean data field is chosen, the parameter component is shown as a check box, while a string data field is shown as a text field. Any input restrictions configured for the data field, also affects the parameter component behavior.
If more than one condition is configured, it must be decided how they should be treated when inserted in the query. The options are: ONE of the conditions must be true (OR), or ALL conditions must be true (AND). This is chosen in the combo box in the top left corner of the tool, see Figure 112.
When the configuration is satisfactory, the query can be executed as explained below.
The Query Writer
The Query Writer tab enables the user to write a customized SQL query. There is a text area in which the query is typed in. The button named Get query from query builder, copies the SQL query configured in the Query Builder tab to the text area, and the user can then modify the query before execution.
Figure 114 and Table 68 explains the basic parts of the Query writer.
| Section | Component | Description |
|---|---|---|
| 1 | Text area | Text area where an SQL query can be written. |
| 2 | Get query from the button Get query from query builder | Copies the query configured in the Query Builder tab, to the text area. |
The only constraint on the query defined in the Query writer is that it must begin with the text string: SELECT*FROM. This is for prohibiting an execution of an SQL statement, that harms the simulation cases stored in the database.
When the configuration is satisfactory, the query is executed as explained below.
Executing the query
When the query configuration is satisfactory the statement is executed using the Execute button in the lower right corner, see Figure 111.
The number of matching simulation cases are prompted in the bottom right corner. It is always possible to go back and modify the query in the Query builder or the Query writer, and execute the new configuration.
When a number of simulation cases have been found, it is possible to open them in a new simulation set in the Simulator. This is done by pressing the Create simulation set button in the bottom right corner of the tool.



