# Insert template rows

Plan enables efficient hierarchy handling with template rows, allowing you to insert custom rows across all levels of a hierarchy at once, instead of adding them individually.

In this article, you learn how to insert template rows and use them across hierarchy levels.

### Create a template row

1. Select the row above which you want to insert the template row.
2. Go to **Planning > Insert Row > Data Input** and select **Number**, or select the **row gripper,** then choose **Insert > Data Input.**
3. In the **Static Row** panel, select **Templated**, enter a title, and configure values as needed:

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

4. You can configure a default value for the template row.&#x20;

* Choose **Row** in **Default Value** to source values from another row.
* Choose **Static** to enter a fixed value.
* Or enter values directly in the rows after creation.

5. Finally, select **Create** to insert the row across all hierarchy levels.

{% hint style="info" %}

#### Note

You can also create formula (calculated) rows as template rows by selecting **Planning** > **Insert Row** > **Formula**. Alternatively, select the **Row Type** to *Formula* in the side panel above.
{% endhint %}

### Configure template row properties

Configure other properties for template rows, such as **Scaling Factor**, **Include in total**, **Distribute parent value to children**, and **Allow input**. For more information, see [row properties](/planning-sheets/how-tos/adding-business-logic-and-formulae/rows/insert-manual-input-rows.md#data-input-row-properties).

In addition to these, you can configure the following settings for template rows:

* **Row position**: Defines where the row appears at each category level. By default, it is set to *Auto.*
  * **Auto** - Creates the template row above the selected row.
  * **First** - Creates the template row at the top of each category level.
  * **Last** - Creates the template row at the bottom of each category level.

<figure><img src="/files/S9cFuGnSc01IOpIFzTWO" alt="" width="375"><figcaption></figcaption></figure>

### **Edit or delete a template row**

* Use the row gripper and select the Edit or Delete Row options.
* Or go to **Insert Row > Manage Rows > Template Rows**, hover over the created row, and choose the appropriate action through the icons.

<figure><img src="/files/vbTHoqh6jrDqcUg3qwqG" alt="" width="375"><figcaption></figcaption></figure>

### Conditional template rows

You can control which parent categories and levels receive template rows by configuring template conditions. Template rows are created only for row categories that meet these conditions.

1. In the **Static Row** window > **Template conditions** section, select **Configure**.
2. In the **Set Template Conditions** window, specify where the template rows should be applied by choosing the required categories, and select **Apply**.

<figure><img src="/files/tKgnROekui0eHCyouUZZ" alt="" width="375"><figcaption></figcaption></figure>

3. Use this to restrict or allow specific hierarchy levels to obtain the template rows.

The following image shows the *Energy Drinks* template row inserted only for the selected category, *Beverages*, across the hierarchy.

<figure><img src="/files/4IrFzQXi1AvgSgt6BlGi" alt=""><figcaption></figcaption></figure>

### Dynamic referencing in template rows

Plan provides a dynamic referencing feature that allows you to reference a sibling’s child row while inserting calculated template rows. This enables values to be automatically populated based on the corresponding parent category.

#### Create a dynamic reference in template rows

1. Select the row above which you want to insert the template row.
2. Go to **Planning > Insert Row** and select **Formula**, or use the **row gripper > Insert > Formula.**
3. In the **Calculated Row** window, select **Templated** and enter a title.
4. Define a formula using **References** to source values from a sibling row.

In the example below, a template row named *Cocktails* references the value of *Soda* under the *Beverages* category.

<figure><img src="/files/mlivbeBzxRAMAkeyevVI" alt="" width="375"><figcaption></figcaption></figure>

The referenced value is applied across all sibling categories within the same *Sub Region*. For sub-regions such as *APAC* and *EMEA*, the *Cocktails* row dynamically retrieves the value of the *Soda* subcategory within each respective sub-region.

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


---

# Agent Instructions: 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:

```
GET https://docs.fabricplan.com/planning-sheets/how-tos/adding-business-logic-and-formulae/rows/template-rows.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
