# SharinPix Form Formula: Referencing Repeated Section Fields

## Overview

{% hint style="info" %}
The Repeated Section question can be used to add any number of pre-defined sections when filling out a form. Each added section can contain its own set values which can be referenced inside formula fields.

This article covers the following:

* [Referencing Repeated Section Fields](#referencing-repeated-section-fields)
* [Demo: Displaying Comments Field Based on Broken Item Count](#demo-displaying-comments-field-based-on-broken-item-count)
  {% endhint %}

## Getting Started

### Referencing Repeated Section Fields

To reference a nested question from a repeated section in a formula field, use:

<mark style="color:$danger;">`<RepeatedQuestionApiName>.<NestedQuestionApiName>`</mark>

The above expression returns a **list** of all <mark style="color:$danger;">`<NestedQuestionApiName>`</mark> values.

#### Example:

Consider a repeated section with API name <mark style="color:$danger;">`RoomItems`</mark> with a nested question having API name <mark style="color:$danger;">`Status`</mark>

![](/files/Vi7u4IzupbBNfA4M11EL)

![](/files/EpQz7wSeuKElXgWDYd7k)

In a formula field, you can reference the nested <mark style="color:$danger;">`Status`</mark> field as shown below:

![](/files/7vvtKVi2NfW7H3nOY2sO)

Because <mark style="color:$danger;">`Status`</mark> is inside the <mark style="color:$danger;">`RoomItems`</mark> repeated section, <mark style="color:$danger;">`RoomItems.Status`</mark> returns a **list of values** – one value for each added *Room Item*

<mark style="color:$danger;">`RoomItems.Status`</mark> will return <mark style="color:$danger;">`['Dirty', 'Clean', 'Broken']`</mark> for the *Room Items* below:

![](/files/uXDIZxmtoCDL04mkKBEd)

## Demo: Displaying Comments Field Based on Broken Item Count

This example demonstrates referencing a repeated section field in a formula field within a Room Inspection example. If two or more items are broken, an additional required question will be visible to provide more information on the damage and follow-up actions required.

The diagram below shows a *text area* question configured with a visibility formula. This question is configured to be visible when two or more *Room Items* have *Status* "Broken"

The formula uses the <mark style="color:$danger;">`COUNTMATCHES`</mark> function to count the number of times the value <mark style="color:$danger;">`"Broken"`</mark> is found in the list returned by <mark style="color:$danger;">`RoomItems.Status`</mark>.

![](/files/yCBJQncvQ3xch6V1KIak)

The diagram below shows the form filled with only one broken *Room Item.*

![](/files/VT6QJj32dbVTgBI9dWU6)

The diagram below shows the form with the *text area* question visible once a second broken *Room Item* is added.

![](/files/mdO9lIM2ZaZrSQ2PnSnh)


---

# 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.sharinpix.com/forms/form-sections-and-repeated-sections/sharinpix-form-formula-referencing-repeated-section-fields.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.
