> For the complete documentation index, see [llms.txt](https://docs.agilecase.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.agilecase.com/administrator-documentation/templates/creating-a-template-with-selectable-rows.md).

# Creating a Template with Selectable Rows

This lesson will show you how to create a template that can pull data from individual rows of a custom field table. This kind of template allows you to use a single template to create documents for each row in a custom table, rather than having to use a separate template for each.

{% stepper %}
{% step %}

## Create a Mergefield Using the "SelectRowNumber" Widget

<figure><img src="/files/72ICbAUIU1xOjML9bzr7" alt=""><figcaption></figcaption></figure>

In order to use a row select function in a template, you must include the "SelectRowNumber" widget.

To use the widget, enter the IF block:

`IF{MERGEFIELD RowNumber}= "{MERGEFIELD SelectedRowNumber}"`

After you have done this, you can then construct your template as usual, using mergefields from your custom field table.
{% endstep %}

{% step %}

## When Creating the Document, Select the Row You Want to Be Populated

<figure><img src="/files/JGhCedZMMvSkidc6udcu" alt=""><figcaption></figcaption></figure>

When you create a document using a selectable row template, you will be presented with an additional dropdown menu that allows you to select which row you want to use to populate the table.
{% endstep %}

{% step %}

## Document Populated with Information for the Selected Row

<figure><img src="/files/6ZuPHANkClMz8JsmESpr" alt=""><figcaption></figcaption></figure>

The screenshot above shows the content of a document created using the row that was selected above.
{% endstep %}
{% endstepper %}


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.agilecase.com/administrator-documentation/templates/creating-a-template-with-selectable-rows.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
