# Live queries

A live query is a search inside a page. It shows the matching lines and keeps up as the workspace changes. Use it for a dashboard, a project review, or the list of things waiting on you.

## Make one

Run a search and drag the query from the search panel onto a page. Or pick **Live Query** from the @-menu and type the query. **Change query** in the block's menu edits it later. Give the block a heading that says what it shows, such as "Overdue" above `@todo @overdue`. A block without a query shows `@today`.

## What it shows

- The results are the real lines, not copies. Edit one or tick a task off, and the change is made in the page it lives on.
- Up to 100 results: pages first, then lines, not sorted further. Lines that start matching are added at the end.
- A line that stops matching, such as a task you just ticked off, stays in the block until it loads again, for example when you open the page again.
- With nothing to show, the block says "No results". A query that can't run shows its error in the block.
- The block folds like any other section.

## Pages instead of lines

A query matches lines anywhere in the workspace, so one block can show a task from one page next to a paragraph from another. Add `@page` to get only pages: each result is a page, matched on its title and properties, not on the lines inside it. That makes a box of related pages, such as on a customer's page:

```text
@page @linkto="Acme"                   pages with Acme in a Page Link property
@page @Projects.Status="In progress"   active projects
@page @created_at = thisweek           pages created this week
```

## A dashboard page

A team page works well with three or four narrow queries:

```text
@todo @overdue                 overdue work
@due = thisweek                due this week
@todo @waiting                 waiting on others
@discuss                       open questions
```

Add links to the project board and the handbook, and pin the page. For a table or board of pages from several collections, use a [dynamic collection](../collections/dynamic-collections.md) instead.

## Related content on every page

A collection can show a query at the top of each of its pages, with the page itself as the context. Set it in **Collection Settings... → Related**. Two variables make it work: `$currentpage` for the page being viewed, `$currentcollection` for its collection. They are filled in only here, not in live query blocks.

```text
@task @linkto=$currentpage        tasks that link to this page
@linkto=$currentpage              anything that links to it
@task @linkto=$currentcollection  tasks that link to the collection
```

With this, a project page lists every action that mentions it, wherever those actions were written. The Journal's Upcoming section is the same mechanism with a date-aware query.

The [Query language reference](query-language-reference.md) lists every filter, has dozens of examples, and explains the variables that Related and Upcoming fill in.
