A query has two main parts:

  • One or more scripts. This defines or these define which data is extracted from the model.
  • The desired output presentation type. This defines how the data is to be presented.

A script creates a set of data with some structure. The type of data varies from objects to numbers and text. You, as a script writer, are in control what (type of) data you extract.

The script results can be interpreted as rows of information, each row containing a number of elements. The number of elements in each row does not have to be the same, and even the types of data in each row may differ from row to row. This allows for maximum freedom to produce any kind of information. You determine what kind of information you would like to produce and what meaning it has to you (and other users).

New scripts are written via the Query tool window. The Query tool can be opened via many context menus, and by clicking Advanced > Query tool (Ctrl+Q) in the ribbon.

When opening the Query tool via the ribbon or using the shortcut key combination, make sure the focus in the model browser is on a model or a component within the model. If the focus is on the model package or if there is no focus at all, you will not have full functionality in the Query tool.

The Query tool window has several parts: a text input field (for the scripts), an output field for (error) messages, and a part for selecting the output presentation type, and saving the query:

Buttons, shortcut keys and boxes

Output type

Select the desired presentation type from the presentation type list (e.g. table, cross-reference table or color view).

Save, Save as (Ctrl+S)

Save the query.


Open the Scripting reference for help on the Query tool and scripting.


Open the Metamodel Browser to look up the names of types, attributes and enumeration values.

Break (Ctrl+Alt+F5)

Pause the script during execution. This allows you to start debugging from that point. To resume the execution, click Continue (F5).

Execute (F5)

Execute the script. This allows you to test the script directly from this editing environment. To stop the execution, click Stop (Shift+F5).

Close (Esc)

Close the Query tool window.


Open the Find window for searching text in the script. Pressing F3 after that will repeat the last search.


Search for the currently selected text in the script. Keeping Ctrl pressed and repeatedly pressing F3 will show the next found text.

Ctrl+Shift+F3 will search for the selected text in the opposite direction.

F4, Shift+F4

Select error messages in the messages field of the Query window tool. You can also select messages by scrolling and clicking.

Any error messages or warnings are shown within the messages box. Errors halt execution immediately, and the cursor is placed at the point where the error was detected. Warnings do not interrupt execution, and are shown for your information.

Break points and step-by-step execution

To enable you to locate and solve script errors, the Query tool offers debugging features like break points and step-by-step execution.

By pressing F9 while standing on a script line, a break point is placed on that line. A break point is displayed as a dark red dot in the margin. Pressing F9 again will remove it. The execution of the script will be paused when the line with the break point is reached: a yellow arrow in the margin indicates the line where execution stopped.

When a script is paused, the names and values of all variables in scope will be displayed in the message box, for you to examine. Script execution is resumed by pressing the Continue button (or F5).

Break points may be freely added or removed (using F9) when a script is paused. And instead of resuming execution fully, repeatedly pressing F6 while the script is paused will advance execution step-by-step, as if each line contains a break point. (Execution might take several tries to advance one line, because a line of code may describe multiple steps.)

When a script is paused it cannot be modified, and many other functions will be disabled. For certain presentation types (e.g. the browser) scripts are executed (possibly repeatedly) in response to certain user actions: If such a script contains a break point, it will pause during each execution and the Query dialog will receive the focus (as long as it has not been closed). The presentation of data by the output mechanism may be temporarily inconsistent due to the script being paused.