# 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%20(162).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>
