---
title: Defining report parameters
related:
  - https://docs.kentico.com/13/configuring-xperience/working-with-system-reports/creating-reports.md
  - https://docs.kentico.com/13/configuring-xperience/working-with-system-reports/example-creating-a-simple-report.md
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

Reports and their data can be filtered using parameters.

To create parameters for reports:

1. Open the **Reporting** application.
2. Select the report in the tree.
3. Switch to the **Parameters** tab.
4. Click **New field**.
5. Define the properties of the parameter (using the [field editor](https://docs.kentico.com/13/custom-development/extending-the-administration-interface/developing-form-controls/reference-field-editor.md)).

   ![Creating report parameters](https://docs.kentico.com/docsassets/13/defining-report-parameters/Report_Parameters.png "Creating report parameters")
6. Click **Save**.
7. Switch to the **General** tab.
8. Add the parameter to the queries of the report objects (table, graph or value).

   - All parameters that you define can be used in the query using the @ expression (e.g., _DocumentCreatedByUserID = @UserID_).

For an example of using parameters in reports, see the Defining report parameters section of [Example - simple report](https://docs.kentico.com/13/configuring-xperience/working-with-system-reports/example-creating-a-simple-report.md#defining-report-parameters).

### Context parameters

In your queries, you can use parameters that provide information about the current context when the report is viewed, such as current user, current site, etc.

- @CMSContextCurrentUserID
- @CMSContextCurrentUserName
- @CMSContextCurrentUserDisplayName
- @CMSContextCurrentSiteID
- @CMSContextCurrentSiteName
- @CMSContextCurrentSiteDisplayName
- @CMSContextCurrentDomain
- @CMSContextCurrentTime
- @CMSContextCurrentNodeID
- @CMSContextCurrentCulture
- @CMSContextCurrentDocumentID
- @CMSContextCurrentAliasPath
- @CMSContextCurrentDocumentName

For example, if you want to display a list of all expired documents of the current website, you can use a query like this:

```sql

SELECT NodeAliasPath AS [Node path], DocumentCulture AS [Culture]
FROM View_CMS_Tree_Joined
WHERE DocumentPublishTo < @CMSContextCurrentTime AND NodeSiteID = @CMSContextCurrentSiteID

```

### Displaying parameter values in the report using macros

If you need to display the parameter values in the report, you can place the following macro expression in the report text: **{%parametername%}**

For example:

**List of pages expired on or before {%CMSContextCurrentTime%}**

displays:

**List of pages expired on or before 2/12/2013 12:06:49 PM**

You can use this syntax for both custom report parameters and context parameters.
