> For the complete documentation index, see [llms.txt](https://docs-v3.toucantoco.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-v3.toucantoco.com/visualizations-and-layouts/creating-visualizations/advanced-chart-configuration/templating-from-charts-dataset.md).

# Templating from chart's dataset

## Overview

As an App Builder, you could want to display information from datasets to contextualize your stories.

## Usage

In order to template the dataset's column value, you'll need to use the following syntax:

```
<$= data["CHART_ID"]["datasetColumn"] $>
```

In the " Information " section, you can retrieve the chart's ID inside its configuration form, inside the "Information" section.

<figure><img src="https://1809014303-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZxYYf1KpgarKMgMsDCrw%2Fuploads%2Fgit-blob-bc0b3c5fac87647d35b69b182995ffbba1538423%2Fimage.png?alt=media" alt="" width="143"><figcaption></figcaption></figure>

However, when referring to a column resulting from an aggregation made through the SmartEditor, the column ("my\_column") to which you must refer follows this format: \_\_aggregType\_myColumn\_\_.

So for example, when referring to a column "profit" aggregated with the sum operator, the syntax to use will be:

```
<$= data["4c7274d9-bae4-e77c-d1ef-21ddd98dee0c"]["__sum_profit__"] $>
```

Here is the list of the different aggregation prefixes: sum (for sum), avg (for average), min (for minimum), max (for maximum), first (for first), last (for last), count (for count), count distinct (for Count Distinct).

{% hint style="warning" %}
As of today, you can't refer to a column that isn't used in your chart's configuration.
{% endhint %}

## Example in a Narrative

**Templating**

*(also starring a Filter's value)*

<figure><img src="https://1809014303-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZxYYf1KpgarKMgMsDCrw%2Fuploads%2Fgit-blob-360f4cd31d26ab832b7848786ec03061b4b08729%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

**Templated**

<figure><img src="https://1809014303-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZxYYf1KpgarKMgMsDCrw%2Fuploads%2Fgit-blob-129ed4f2ac0347354e70c22caf59f6de33f8694b%2Fnarrative-templated.png?alt=media" alt="narrative-templated"><figcaption><p>Narrative - templated</p></figcaption></figure>


---

# 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://docs-v3.toucantoco.com/visualizations-and-layouts/creating-visualizations/advanced-chart-configuration/templating-from-charts-dataset.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.
