> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flexagon.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Saved Queries

> Saved Queries allow users to save search criteria and additional formatting options to keep your data just the way you like it. What are Saved Queries

## Saved Queries allow users to save search criteria and additional formatting options to keep your data just the way you like it.

## What are Saved Queries?

Saved Queries are capable of saving the following information so you can quickly return to, or even set default, views for tables.

* Search Filters

* Sort Directions

* Visible/Hidden columns

* Column Order

* Column Sizes

* Column Renames

For example, in the below screenshot we have a saved query applied for the Environment History Report called **Production**. This Saved Query applies a filter on Environment for “prod“ and sorts on the Requested On column.

![image-20240219-201330.png](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12590915919.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=1b86733e8318d8f017a254ddf5921d6c)

> [!NOTE]
>
> By default, the last Saved Query we were viewing on a page will be restored when coming back. Meaning this Production query will be applied to this page indefinitely.

## Creating a Saved Query

In order to create a Saved Query, perform the following:

![(blue star)](https://flexagon.atlassian.net/wiki/s/-845207469/6452/623c691c1356a9708795fbf2d3eb7953dc11488c/_/images/icons/emoticons/72/31-20e3.png) Apply any filters, sorts, or column altering you would like to be saved.

![image-20240219-201553.png](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12590915916.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=dc7c4dce29ff393ee9413412d678de57)

![(blue star)](https://flexagon.atlassian.net/wiki/s/-845207469/6452/623c691c1356a9708795fbf2d3eb7953dc11488c/_/images/icons/emoticons/72/32-20e3.png) Click on the **Select a saved query** dropdown and click the **Create Saved Query** button.

![image-20240219-201745.png](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12590915925.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=cc6a3b816bf22a20894e8dbc41e9b84b)

![(blue star)](https://flexagon.atlassian.net/wiki/s/-845207469/6452/623c691c1356a9708795fbf2d3eb7953dc11488c/_/images/icons/emoticons/72/33-20e3.png) This will open a popup where you can provide a name for your Query, share it, and/or create an automated export.

![image-20251008-172319.png](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12590915931.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=db30d1eef4a275899d0bad75639bcbad)

You also have the ability to customize the export options for your saved query.

![image-20250724-145131.png](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12590915937.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=50bd14bb648120c56310ae85023da9fb)

At any point, we can now return to this table and easily apply this Saved Query.

### Sharing a Saved Query

A Saved Query can be shared in 2 ways:

* Sharing with specific groups

  * Any user a Saved Query is shared with can select it, view it, and optionally subscribe to it (see below).

* Global Share

  * Checking the Global option for sharing will share it with all FlexDeploy users. This will also disable the Group Share since it becomes redundant.

Once a Saved Query is shared, it will show up in a separate **Shared With Me** section in your list.

![image-20240219-203805.png](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12590915934.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=f24ad24cb181235a1fa62594e4289280)

> [!NOTE]
>
> **What can users do with a Shared Saved Query?**
>
> Once a Saved Query is shared, non-admin users will be able to view and subscribe to the query but they will not be able to modify it in any way.
>
> Admin users, on the other hand, can edit and modify shared Saved Queries.

### Automating Saved Query Exports via Subscriptions

Certain views, such as Reports, allow configuring Saved Query Subscriptions (automated scheduled Exports available in CSV or PDF format). There are a few configuration options for subscriptions that are outlined below:

* Allow Subscriptions

  * Before you or users the Saved Query is shared with can subscribe, subscriptions must first be enabled by the owner or an Admin the Saved Query is shared with.

* Format

  * The format of the export. Available options are CSV, PDF Table, and PDF Record. *Note PDF has a 15 column limit.*

* Cron Expression

  * The cron schedule will define how frequently the export is sent out to all subscribers.

> [!NOTE]
>
> **Relative Datetimes in Subscriptions**
>
> Under most circumstances it is beneficial to add a Relative Date Time filter to your Saved Query that aligns with your Cron interval. (e.g. All new entries in the past week: -1w) This ensures the export will only contain new rows since the last time the export was sent.
>
> This can be done by using the **Relative** filter option on any datetime column.

With Subscriptions allowed for the Saved Query, users can subscribe by clicking the :notification: button on the Saved Query. Admins will see the subscribe option available in the Edit Saved Query Popup.

Should the resulting data set be empty, the query export will still be sent with an empty PDF or CSV file.

## Modifying a Saved Query

![(blue star)](https://flexagon.atlassian.net/wiki/s/-845207469/6452/623c691c1356a9708795fbf2d3eb7953dc11488c/_/images/icons/emoticons/72/31-20e3.png) In order to modify a Saved Query, it must first be selected.

![(blue star)](https://flexagon.atlassian.net/wiki/s/-845207469/6452/623c691c1356a9708795fbf2d3eb7953dc11488c/_/images/icons/emoticons/72/32-20e3.png) With the Query selected, modify the filters, sorts, and columns as you normally would.

![image-20240219-205701.png](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12590915928.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=f40c96943739e42bc768b6a3ab8849c9)

Notice the undo/save buttons that appear. This indicates changes have been made to the query.

![(blue star)](https://flexagon.atlassian.net/wiki/s/-845207469/6452/623c691c1356a9708795fbf2d3eb7953dc11488c/_/images/icons/emoticons/72/33-20e3.png) Click on the **Save Icon** to save your changes.

Alternatively, you can also undo all changes by clicking the **Undo Icon** to the left. This will reset the Saved Query to its original state.

> [!TIP]
>
> #### Pro Tip
>
> You can easily duplicate queries by simply selecting the one you wish to copy and then clicking the Create Saved Query button again and providing a new name.

> [!NOTE]
>
> #### Recommended Reading
>
> Take a look at the [Data Table](https://docs.flexagon.com/flexdeploy-11-1-documentation/flexdeploy-users-guide/working-with-the-data-table.md) documentation to learn how to get the most out of Saved Queries.

***

## FAQ

### Can you share Saved Queries?

Yes! Since **@8.0.0.0** Saved Queries can be shared with 1 or more groups via the Create/Edit popup.

### Why does my Query show as modified even after undoing changes?

Sometimes this can occur between releases if the column names change. In this case, you can freely save the query updates to accept the new column name.
