# Run a Query

A query is a way to filter out Document Objects based on certain filter criteria. In Aligned Element, you can add Queries, modify, copy and rename Queries and also delete them.&#x20;

A query essentially consists of:&#x20;

* an input set of document objects&#x20;
* a number of filters

These two in combination yield an output set of Document Objects. Queries can be performed on current Document Objects from the master project and the linked projects. Objects from snapshots, or of older revisions, cannot be included in a Query.

{% hint style="info" %}
Note! A Query can only be performed on Document Objects of the same Document Object type.
{% endhint %}

## How to run a Query

In the **Navigation Bar** entry **Query**, select the type name for the **Query**. In the next view, the left side will display a list of available queries of the type name.&#x20;

<figure><img src="/files/SkQNdgqJnKwM2ycKHvVI" alt=""><figcaption></figcaption></figure>

Selecting a query name will display the query definition of the query on the right side. This information includes:

* The user who created the query (Created by)
* The creation date of the query (Created on)
* The last modified date (Last modified on)
* The input set search mode
* The query conditions
* The displayed attributes
* The input set definition

To run the selected query, click **Run**. The result; i.e., the Output Set, is displayed on the lower part of the screen.

Use the search bar to search for a query. The search looks for matching words in the query title, query description or name of the user who created the query.

Click the star icon to mark a query as a personal Favourite. Favourite queries will always be displayed at the top of the list for fast and easy access.

{% hint style="info" %}
Note! The 'Created on' date signifies the date when the Query received its current name. If the name of the query has been modified several times, the 'Created on' date signifies the most recent name modification.
{% endhint %}

### Actions on the Query Output Set

Use the Action button to perform the following actions on the Output Set.

* Generate Multiple...
* Display Inconsistencies
* Display Consistency Coverage
* Display Chart
* Lock Document Objects
* Set Snapshot
* Generate Word Report
* Generate Template based Word Report
* Generate Excel Report
* Export Document Objects

## Export a Query

Select a Query and click **Export** to export the Query definition to an xml file. The xml can be used to import the query in other Projects.

{% hint style="info" %}
Note! The exported file contains the definition of the query, not the items in the input set or output set.
{% endhint %}

## Import a Query

Click **Import** to select an exported Query xml definition file and import it. If necessary, adapt the Query input set after the import is completed.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aligned.ch/aligned-elements-web-client-user-manual/3.2.287.25450/queries/run-a-query.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
