# Design a Query

## How to Design a Query

Use the **Add** button to create a new Query or the **Edit** button to edit the selected Query.

<figure><img src="https://1044960039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoFzlKSOnBIuMqSKfKVst%2Fuploads%2Fve3oVii7hRxBScmPGyGk%2Fimage.png?alt=media&#x26;token=a787d5c6-10e4-43f0-9731-848150c95cd9" alt=""><figcaption></figcaption></figure>

This will display the Query Designer.

<figure><img src="https://1044960039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoFzlKSOnBIuMqSKfKVst%2Fuploads%2FsHRYOo557LYqVotaNeS6%2Fimage.png?alt=media&#x26;token=58a4e2b9-16c4-4baa-b8e3-773b247621fa" alt=""><figcaption></figcaption></figure>

### Query Name

The name of the Query. Select a name that summarizes what the Query does.

### "Search In"-mode

The Search In dropdown defines how far in the Document Object history the query shall search and what to include in the output.

The following search modes are available:

#### Current Revision (exclude disabled)

This is the default search mode. The search is only considering the most current revision of the Document Objects in the input set, but excludes currently disabled Document Objects.

#### All Revisions (exclude disabled)

The search mode considers all revisions of the Document Objects in the input set, but excludes currently disabled Document Objects. The output set can thus include several revisions of the same object.

#### All Revisions, Get Last (exclude disabled)

The search mode considers all revisions of the Document Objects in the input set, but excludes currently disabled Document Objects. The output set yields only the (chronologically) latest match of all revisions of the same object. The output set thus only contains one revision for each Document Object.

#### Current Revision, include disabled

This search mode only considers the most current revision of the Document Objects in the input set, and includes currently disabled Document Objects.

#### Current Revision, only disabled

This search mode only considers the most current revision of the Document Objects that are disabled.

#### All Revisions include disabled

The search mode considers all revisions of the Document Objects in the input set, including currently disabled Document Objects. The output set can thus include several revisions of the same object.

#### All Revisions only disabled&#x20;

The search mode yields all disabled revisions of the Document Objects in the input set. The output set can thus include several revisions of the same object.

### Description

Describe the intended purpose and planned usage for the query to efficiently communicate to other users why this query exists. &#x20;

### Lock a Query

Users with Project Management user rights have the possibility to Lock (and unlock) a query by checking the **Locked** checkbox. A locked query design cannot be edited or disabled by other users.&#x20;

### Add Filters&#x20;

Use the **Add 'AND' Filter** or **Add 'OR' Filter** dropdown to add new filters. Use the **Minus** button next to the filter to remove a filter.

See the [Filters section](query-filters) for details about the available filters.

### Displayed Attributes

Use the **Displayed Attributes** dropdown to select the attributes to be displayed in the Output grid. A separate column is created for each attribute.

### Input Set

Select if you want to use a Static or Dynamic Input Set.&#x20;

The difference can be explained as follows:

* A Static Input Set consists of a defined number of document objects. If a Document Object becomes disabled, it is automatically removed from the input set. If a Document Object in the input set is modified, the input set is updated to include the new revision of the object. However, if a Document Object created/added, it is NOT automatically added to the input set. The user has to explicitly add it to the input set using drag-and-drop.
* A Dynamic Input Set consists of a defined number of chapters (and optionally their subchapters) and implicitly of all Document Objects in those chapters. The set is updated for disabled and modified Document Objects, just as for Static Input Sets. The big difference is that a Dynamic Input Set automatically includes Document Objects that have been created/added or moved to its chapter set.

## How to copy a Query

Click on the **Copy** button. This will create a copy of the selected query and allow you to modify it and save it under a new name.

## How to delete a Query

Click on the **Delete** button to delete the Query.

{% hint style="info" %}
Note! A deleted Query cannot be restored.
{% endhint %}

## Using Queries to find disabled Document Objects

Create a new Query. Leave the **Input set** to default. Set the **Search in** parameter to **Current revision, only disabled.** Save the query and run it. You can now export these items to Word or excel, or use Update Multiple Items to enable the Document Objects.&#x20;
