SA XT for web access : System Architect XT : User interface : Creating and building questions/queries
  
Creating and building questions/queries
Creating questions/queries
You can ask questions about the information in the repository. Click the CREATE MY OWN QUESTION/QUERY selection on System Architect XT’s main page (if the default template is deployed) to access the QUERY/QUESTION page.
Building queries
You can ask questions about the information in the repository using System Architect’s native SQL-query-like reporting language.
If your encyclopedia supports workspaces then controls are presented for reporting across workspaces.
The button leads to a workspace selector dialog where you can tick the workspaces the report is to be run against. If no workspaces are ticked then the report is run against all workspaces.
Notes on reporting across workspaces
The Restrict output per workspace to records in that workspace option means creations and modifications made in this workspace, so excludes anything that was inherited from parent workspaces that was not changed.
The values returned by the WorkspaceName and WorkspacePath fields will be those of the workspace being reported on, when a report is run across workspaces, in order to understand records that might otherwise appear to be duplicates.
A Query Builder graphical user interface is provided below the Enter Query field and can be used in this way:
1 Where tab – Pick which data to query against in the Where tab. This includes choosing Diagram, Symbol, or Definition class, and which types to include (the default is All). You may change the Type selection by double-clicking or dragging from Available to Selected and the other way round.
2 Conditions – Conditions can be added in the Where tab to further filter your results. Click the (+) button to add additional conditions, or the (-) button to remove them.
3 Subreports – Subreports can be added to create layered reports. Click the (+) button to add subreports, or the (-) button to remove them. Use the Up or Down arrows to change the order of subreports.
4 Select tab – This tab presents options for which Properties to include in the Report Output. All selected Properties will be shown as a column in the output – if none are selected, the default property is ‘Name’. You may change the Property selection by double-clicking or dragging from Available to Selected and the other way round.
5 Sort and Display Options – When properties are added to the selected column, they are also added to the Sort and Display Options section. Report output will be sorted by any properties with the Sort checkbox checked. If multiple Sorts are enabled, you can use the Up/Down arrow to adjust priority top to bottom. You also can change the column Label text and choose whether to sort Descending or Case Insensitive.
6 Level 2 and beyond – In the left pane there is an option to create a second level of reporting based on chosen References. When you choose a Reference, the 2nd level Where and Select tabs will be populated with the appropriate data, and the UI will behave the same as the Top Level. When a reference is selected in Level 2, a 3rd Level will become available, and new levels will become available with each added Reference up to 9 Levels.
7 Submit Query – When the Query is complete, click Submit Query. The report will run and the output will be displayed on a new page. For how to use the output, see Query Results Page features.
8 Save Query – When you have a query that you would like to re‑use, you can click the Save button to add it as a Shared or Private Query. Shared Queries can be seen by all users; Private Queries will be available only to your User ID. Users can also select an external .rpt file to save to. Shared and Private Queries will appear as available from the Run Saved Query dropdown, where if selected, the query will run and open the Results page. Saved Queries will also be added to the sidebar as an executable link – if clicked, the query will run and open the Results page. On the side bar, you can click the Manage Queries link to remove and adjust the order of Saved Queries. The Manage Queries page also has the option to Export your queries to a downloadable .rpt file.
9 Load Query – The Load Query button gives users the option to import previously saved queries into the Query Builder graphical user interface. When a previously saved query is selected, it opens a new page and attempts to select options as defined in the saved query. If the Property Set of the saved query does not match, or if it was Text Edited before being saved, it is possible the Loading process will fail and a warning will be presented giving you the option to load the Complete query text as Text Edit mode, or load the incomplete results that were able to be loaded into the GUI successfully.
10 Reset – The Reset button gives users the ability to clear the Query selections without having to refresh the browser page.
You may also build your query in System Architect using the Report Generator, and then copy and paste that query into the Enter Query to Run field of System Architect XT.
Build the Query in regular System Architect
1 In regular System Architect, select Reports > Report Generator. The Reports dialog will open and present the reports of the last report file (.rpt file) that you had open.
2 In the Reports dialog, optionally select File > Open Report File to open one of the pre-built report files that comes with System Architect, or select File, New Report File to create a new one.
3 In the Reports dialog, click New. Use the Reporting System graphical user interface to create a report. See the online help for instructions on how to navigate the fields.
4 Make sure the report generates the proper output by clicking Draft. Click OK to save the report.
5 Click Report > Text Edit to access the actual textual code of the report.
6 Select the code of the report starting at the first SELECT statement, and ending before any closing ellipses whose starting ellipse you did not select.
7 Press Ctrl+C to copy the code. Close all of the report dialogs in System Architect.
Note To report on properties for certain definitions, you have to use the FIELD statement or the EXPLICIT OFF keyword for the query to work properly. Not using these may return a Report is Invalid message.
8 In System Architect XT, return to the Question/Query page, click the Text Edit button, and then paste the code into the Enter Query to Run field.
9 Click Submit Query.
The report will run and the output will be displayed on a separate page. For how to use the output, see below.
Query Results Page features
By default, the Query Results are presented using the Lists.xsl stylesheet, which has several unique features:
Charting – Click the Pie chart icon to visualize the data as a D3 chart. These charts have many customization options, as well as the ability to filter your report even further by selecting chart data and clicking the Filter button.
Word, Excel, Save, Print – By clicking the respective button, the Query Result page can be saved as Microsoft Word(.doc), Microsoft Excel(.xls), Save(.htm), or printed to your printer to use outside of the System Architect XT web applications. Stylesheets do not get included with the Output, so graphics and fonts might not appear exactly as they do in System Architect XT.
Bookmark the URL – The Query Results page URL contains all the data necessary to rerun the report at a later date with updated results. This means that you can use System Architect XT’s built in Bookmark option to add the bookmark to System Architect XT’s right sidebar, or use your web browser’s Bookmark option. You can also email the URL to others who have the same encyclopedia permissions, for them to run.
Resort table – To do so, click on any column headers. When the table is resorted using the column header the original Sort options of the query will be ignored. You can refresh the results page to return to the original Sort options.
Hyperlink selection – Some data is presented with as a hyperlink that will open properties of the selected items on a new System Architect XT page.