# Create an index

The Index feature is also similar to a sub-report. It allows you to generate an index based on fields or groups in your report. When the index is generated, it displays the instances and page number where the field name appears.

Follow the instructions below to create an index:

1. Click and drag the index icon onto the report canvas.

   You are prompted to make the index element Inline or Banded. Choose one.

   * Inline sub-reports can be placed side-by-side with other elements (even other sub-reports).
   * Banded sub-reports occupy a variable height, but 100% of the report page width, so they cannot be on the same line with other elements.
2. Click the **index** element; under **Attributes**, double-click data-field and select the field to which you want to map.

   In the example below, the data-field is mapped to PRODUCT NAME.

   ![Data-field mapped to PRODUCT NAME](/files/3Jw5nQMd5SuH8kHEtq36)

   * **data-field**

     Defines the field to be used as the **item-data** or **item-key**.
   * **data-formula**

     Defines an open formula to be used as the **item-data** or **item-key**. Make sure that data-field is not defined, if this is used.
   * **index-separator**

     Defines the separator text that is used between page numbers in the **item-pages** field in the index sub report. It defaults to ",".
   * **condensed-style**

     Defines whether a `-` is used between continuous page numbers; example, `4,5,6,7` would display as `4-7`.
3. Double-click the **index** element.

   A new **sub-report** tab opens.
4. In the new report tab, create the appropriate index heading. Add the item-data and item-pages functions to generate the index data field name and page numbers.

   Keep in mind that all your entries will be included in the parent report. When you are finished, switch back to the main report tab.
5. Preview your report.

   **Note:** The index appears on the last page of your report.

You should now have an index embedded in your current report.


---

# 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.pentaho.com/pba-report-designer/9.3-report-designer/add-report-elements-in-report-designer-cp/create-an-index.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.
