# Dynamic collections

A dynamic collection shows pages from different collections in one place, as a table, a board or any other view. Each of its views is a live query: it shows every page that matches its filter, from the collections you pick, and keeps up as pages change. The pages themselves stay in their own collections. Nothing is moved or copied, and editing a page here edits the original. Other tools call this a linked database or a view across databases.

*A dynamic collection's board, with projects and issues grouped by Status.*

## What they're good for

- **One board for related work.** Projects and Issues are separate collections with their own properties, but triage happens on one board grouped by Status.
- **Everything that's yours.** A table of the projects you own and the issues assigned to you, from both collections. With `@me` in the filter, each person sees their own.
- **Follow-ups.** Customers whose next contact is due next to projects past their due date, in one list to work through.
- **A calendar across collections.** Blog posts and newsletters in one calendar, when both have a Date & Time property with the same name.
- **What changed.** The pages you edited this week, or everything created this month, wherever they live.

Within one collection, an ordinary [view](views.md) is enough. A dynamic collection is for when the pages live in more than one.

## Create one

1. In the sidebar, click the **...** next to the **Collections** heading and choose **New Dynamic Collection**. The command palette's **New collection...** and the New menu (Ctrl+Shift+N on a Mac, Alt+Shift+N on Windows and Linux) have it too.
2. Thymer makes a dynamic collection with one view, **All Pages**: a table of every page in the workspace, with its title, collection and modification date, the most recently changed first. Its settings open.
3. On the **Dynamic Collection** tab, give it a name, an icon and a description.
4. On the **Views** tab, click a view to choose its **Source Collections** and its **Filter**, or add views.
5. Click **Save**. Cancel removes the new dynamic collection again.

## Which pages show up

Two settings of a view decide which pages it shows. Its **Source Collections** say which collections to look in, and its **Filter** picks pages from those. Each view has its own, so one dynamic collection can hold a board of open work and a table of recent changes.

Both are in the view's settings. Right-click the view's name at the top of the dynamic collection and choose **Table Settings...** (or **Board Settings...**, and so on), or open **Collection Settings...** and click the view on the **Views** tab.

## Sources

**Source Collections** lists the collections a view looks in. A new view starts with **All Collections**: every page in every collection of the workspace, including everyone's Journal pages. Click it and pick the collections you want, such as Projects and Issues. Remove them all to go back to All Collections.

- Only regular collections count: a dynamic collection never shows the pages of another dynamic collection.
- Pages in the trash never show.
- The sources also decide which properties the view offers; see Properties below.

## Filters

The **Filter**, further down in the same settings, narrows the pages from the sources down to the ones you want. Leave it empty to show every page from the sources.

The filter takes the [query language](../search-and-navigation/query-language-reference.md). Property filters need the collection's name in front: `@Projects.Status="In progress"` matches pages in Projects only, and `@Status="In progress"` without a name is an error. To cover several collections, join their filters with OR:

| Filter | Shows |
| --- | --- |
| `@Projects.Status!="Done" OR @Issues.Status!="Done"` | Projects and issues that aren't done |
| `@Projects.Owner=@me OR @Issues.Assignee=@me` | The projects and issues of whoever is looking |
| `@Customers."Next contact" <= today OR @Projects."Due date" < today` | Customers to contact and projects past their due date |
| `@modified_by=@me @modified_at = thisweek` | Pages you changed this week |
| `@created_at = thismonth` | Pages created this month |
| `launch` | Pages with "launch" in the title or in a text property |

Use `!=` rather than `not`: `@Projects.Status!="Done"` keeps to Projects, while `not @Projects.Status="Done"` also lets in every page outside Projects. `@me` means whoever is looking, so one view can show each person their own pages. The search box above a view narrows it further.

## Properties

A dynamic collection has the properties of its source collections. Properties from different collections count as one when their name and type both match: Status as a Choice in Projects and in Issues is one Status column, with the choices of both. Each view offers the properties of its own sources.

Besides Title, Icon, Created and Modified, every dynamic collection has two more:

- **Collection**: the collection a page lives in. Changing it, in a cell or by dragging a card between columns grouped by Collection, moves the page to that collection.
- **Modified By**: who changed the page last.

Editing a value changes the page itself, in its own collection, with that collection's choices. A page whose collection lacks the property can't get a value for it: its cell can't be edited, and dragging its card to such a column says "Not available for this page".

A dynamic collection can't have properties of its own, apart from formulas: **Add Formula Property** in a view's settings, computed by the collection's code. See [Formulas](formulas.md).

## Views

List, table, board, gallery, calendar and Page Shortcut all work, with sorting and grouping as in any [view](views.md). Boards group by a Choice, User, Tag, Date & Time or Page Link property, or by Collection or Modified By. A board's columns come from the choices of its sources, so you can't add or rename columns on the board itself, and properties with several values can't group a board.

## The pages

- The pages are the originals. Opening one opens the page in its own collection, with its own backlinks and history.
- You can't create a page inside a dynamic collection. Create it in its own collection, and it shows up here when it matches.
- **Move to Trash** on a page trashes the page itself, everywhere.
- A page you change so it no longer matches the filter leaves the view right away.
- The sidebar lists the dynamic collection under Collections, without pages under it.

## Change or remove one

Open its settings with **Collection Settings...** in its menu in the sidebar, or the gear next to **Dynamic Collection** at the top of its panel. Change a view's sources and filter on the **Views** tab, and the name and icon on the **Dynamic Collection** tab or with **Set Title & Icon** in the sidebar.

**Move to trash** in the settings removes the dynamic collection, not the pages: they stay in their own collections. **Restore Collection from Trash** brings it back.

## Good to know

- Anyone in the workspace can create and change a dynamic collection, and the result is the same for everyone. Its code, under **Edit as Code**, is for admins.
- The [Markdown Mirror](../markdown-mirror.md) gives a dynamic collection a folder with only its settings files. Its pages stay in the folders of their own collections.
- Plugins can extend a dynamic collection with a `DynCollectionPlugin`. See [Plugin API reference](../plugins/plugin-api-reference.md).
