> For the complete documentation index, see [llms.txt](https://help.sdocs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.sdocs.com/developer-hub/template-configuration-and-styling/reference-named-query-syntax.md).

# Named Query Reference

Learn the required syntax for named queries in S-Docs. Start with structure, then move to examples, advanced patterns, and SOQL fundamentals when needed.

Use this section when you need exact syntax for named queries.

These reference pages help you define reusable query blocks, understand merge field patterns, work through advanced retrieval patterns, and start from working examples.

{% hint style="info" %}
If you need a first walkthrough, start with [Creating Your First Named Query (Tutorial)](broken://spaces/WKNnJmhJBQwhdk5WBFsi/pages/vyh6YXRukMRCqXK1Qzlo).

If you already have a query block and need exact syntax, stay in this reference set.
{% endhint %}

{% hint style="success" %}

#### Recommended flow

If you are new to named query syntax, read these pages in order:

1. [Named Query Structure](https://help.sdocs.com/developer-hub/template-configuration-and-styling/reference-named-query-syntax/named-query-structure.md)
2. [Named Queries in DOCX and PPTX](https://help.sdocs.com/developer-hub/template-configuration-and-styling/reference-named-query-syntax/named-queries-in-microsoft-templates-docx-pptx-xlsx.md)
3. [Named Query Working Examples](https://help.sdocs.com/developer-hub/template-configuration-and-styling/reference-named-query-syntax/named-query-working-examples.md)
4. [How to: Advanced Data Retrieval with Named Queries](https://github.com/kvantiem-sdocs/Developer-Hub-Documentation/tree/main/advanced-template-logic/named-query/how-to-advanced-data-retrieval-with-named-queries.md)

Use [Introduction to SOQL](https://help.sdocs.com/developer-hub/template-configuration-and-styling/related-list-references/introduction-to-soql.md) if the query itself is the blocker.

Start here when you want the fastest path from syntax to working output.
{% endhint %}

Start with one of these five reference paths:

<table data-card-size="large" data-column-title-hidden data-view="cards"><thead><tr><th>Title</th><th>Description</th><th data-card-target data-type="content-ref">Target</th></tr></thead><tbody><tr><td><strong>Named Query Structure</strong></td><td>Learn the required tags and merge field pattern.</td><td><a href="https://help.sdocs.com/developer-hub/template-configuration-and-styling/reference-named-query-syntax/named-query-structure.md">Named Query Structure</a></td></tr><tr><td><strong>Named Queries in DOCX and PPTX</strong></td><td>Use square-bracket syntax for named query blocks and merge fields in DOCX and PPTX templates.</td><td><a href="https://help.sdocs.com/developer-hub/template-configuration-and-styling/reference-named-query-syntax/named-queries-in-microsoft-templates-docx-pptx-xlsx.md">Named Queries In Microsoft Templates (DOCX, PPTX, XLSX)</a></td></tr><tr><td><strong>Named Query Working Examples</strong></td><td>Start from copy-paste examples for aggregates, filters, and offsets.</td><td><a href="https://help.sdocs.com/developer-hub/template-configuration-and-styling/reference-named-query-syntax/named-query-working-examples.md">Named Query Working Examples</a></td></tr><tr><td><strong>Advanced Data Retrieval</strong></td><td>Learn how to combine filters, offsets, aggregates, and grouped-result patterns.</td><td><a href="https://github.com/kvantiem-sdocs/Developer-Hub-Documentation/tree/main/advanced-template-logic/named-query/how-to-advanced-data-retrieval-with-named-queries.md">https://github.com/kvantiem-sdocs/Developer-Hub-Documentation/tree/main/advanced-template-logic/named-query/how-to-advanced-data-retrieval-with-named-queries.md</a></td></tr><tr><td><strong>Introduction to SOQL</strong></td><td>Review `SELECT`, `WHERE`, `ORDER BY`, `LIMIT`, aggregates, and relationship queries.</td><td><a href="https://help.sdocs.com/developer-hub/template-configuration-and-styling/related-list-references/introduction-to-soql.md">Introduction to SOQL</a></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.sdocs.com/developer-hub/template-configuration-and-styling/reference-named-query-syntax.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
