Executing Queries

The query can be executed at any time by right-clicking on the Query structure or by selecting the option from the Actions menu.

Note
The results of the query are limited by the User’s standard “Get” permissions. In the case of a table row that contains relationship and related_item information you must have “Get” permissions for the related item, otherwise the cells in the row that correspond to the related_item will appear as blank/empty.Query Builder/Tree Grid View can be configured to use the “keyed_name” associated with the related_item. If there is no “Get” access to the related_item, the keyed_name value will appear as “Restricted.”

Executing the query from the top-level element or from the Actions menu executes the entire query structure. However, executing the query from one of the child elements returns the results for that substructure only.

Running the Start Execution command results in a window that looks similar to the following:

The window offers an opportunity to add conditions on top of the ones defined by the search, enter parameter values, and set Max Count. If Conditions and/or Parameters are unspecified the query is executed without any filtering via conditions or parameters. The Max Count is intended to limit the number of top-level items returned by the search. These settings are recommended during development because the number of elements returned by the query could potentially be very large.

When ready, press the Execute command to run the search.

The search for the Part Query defined in Section 2 Developing Query Definitions would return a structure similar to the following:

<AML>
 <Item type="Part">
 <id keyed_name="part_7">82A0B82AAD1C43309075640D21117E90</id>
 <modified_by_id keyed_name="Innovator Admin">30B991F927274FA3829655F50C99472E</modified_by_id>
 <name>part_7</name>
 <state>Preliminary</state>
 <item_number>part_7</item_number>
 <Relationships>
 <Item type="Part CAD">
 <sort_order>128</sort_order>
 <Relationships>
 <Item type="CAD">
 <current_state keyed_name="Preliminary">A29C9720FF0D4950A140A90BEEA903DA</current_state>
 <id keyed_name="cad_1">C94B5097E5894EDA8C39C310F735832B</id>
 <name is_null="1" />
 <item_number>cad_1</item_number>
 </Item>
 </Relationships>
 </Item>
 <Item type="Part Documents">
 <sort_order>1</sort_order>
 <Relationships>
 <Item type="Document">
 <id keyed_name="Doc_01">FFB47BECC6E64E8BBB8254F0A61E9EEC</id>
 <name>User Guide</name>
 <state>Preliminary</state>
 <item_number>Doc_01</item_number>
 </Item>
 </Relationships>
 </Item>
 <Item type="Part Created By">
 <id keyed_name="Super User">AD30A6D8D3B642F5A2AFED1A4B02BEFA</id>
 <login_name>root</login_name>
 <first_name>Super</first_name>
 <last_name>User</last_name>
 </Item>
 <Item type="Simple MCO Part (related_id)">
 <Relationships>
 <Item type="Simple MCO">
 <created_on>2019-03-21T15:59:26</created_on>
 <id keyed_name="MCO-100001">A5DCE160DE28465A8ECDFF37CEA6B75C</id>
 <state>New</state>
 <item_number>MCO-100001</item_number>
 </Item>
 </Relationships>
 </Item>
 </Relationships>
 </Item>
</AML>
Note
All child elements of the top-level Part item are returned as Relationships, including created_by_id and Simple MCO.

Using the Query Execution Dialog, users can opt to save the results returned to a local file instead of having the results displayed in a pop-up dialog. Saving the results in this manner is for convenience when users would like to review query results using a separate editor.

Save Query Results

To save the results from executing a Query Definition to a local file, select the check box labeled Result as File prior to executing the query.

Save Query Results to a File Once the results are returned to the client, the web browser will provide an interface for the user to select a folder and file name to store the results. The default file name uses the Query Definition name with an ‘.xml’ extension. For example, MyQueryDefinition.xml.