---
title: "Get the second last entry from a Scaffolding dynamic table"
canonical: "https://support.appfire.com/space/REPS/472918422/Get%20the%20second%20last%20entry%20from%20a%20Scaffolding%20dynamic%20table"
format: markdown
---
> Macro (aura-html)

## Scenario

This recipe retrieves the second last row of a Table Data macro when the table is dynamic in size and uses Scaffolding Table Data and Text Data macros in the reporting process.

## Result

![image](media://55c37933-fce6-44d2-9f31-723df0eedb2c)

## Recipe

| Apps | Reporting for Confluence Data Center, Scaffolding |
| --- | --- |
| Level | Easy |
| Estimated time | 10 minutes |
| Macros | Local Reporter, Report Block, Report Body, Report Info, Report Variable |
| Suppliers | Scaffold Data Supplier, Variable Supplier |

## Storage format

You can copy and paste this code into the [Confluence Source Editor](https://appfire.atlassian.net/wiki/spaces/REPS/pages/472907841):

```
<p class="auto-cursor-target">
  <br />
</p>
<ac:structured-macro ac:macro-id="99e89354-ca3e-4f20-9afd-d8fefe26ec2e" ac:name="table-data" ac:schema-version="1">
  <ac:parameter ac:name="name">mytable</ac:parameter>
  <ac:rich-text-body>
    <p class="auto-cursor-target">
      <br />
    </p>
    <table class="wrapped">
      <colgroup> <col /> </colgroup>
      <tbody>
        <tr>
          <th>Test</th>
        </tr>
        <tr>
          <td>
            <div class="content-wrapper">
              <p class="auto-cursor-target">
                <br />
              </p>
              <ac:structured-macro ac:macro-id="de37a55c-30ff-47ad-a8d2-529b6f3d9a34" ac:name="text-data" ac:schema-version="1">
                <ac:parameter ac:name="name">mytext</ac:parameter>
                <ac:parameter ac:name="type">line</ac:parameter>
                <ac:parameter ac:name="content">text</ac:parameter>
                <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
                <ac:rich-text-body>
                  <p>
                    <br />
                  </p>
                </ac:rich-text-body>
              </ac:structured-macro>
              <p class="auto-cursor-target">
                <br />
              </p>
            </div>
          </td>
        </tr>
      </tbody>
    </table>
    <p class="auto-cursor-target">
      <br />
    </p>
  </ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
  <br />
</p>
<ac:structured-macro ac:macro-id="31238ba3-aefe-485f-b017-a4fa64511744" ac:name="report-block" ac:schema-version="1">
  <ac:parameter ac:name="injected">true</ac:parameter>
  <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
  <ac:rich-text-body>
    <p class="auto-cursor-target">
      <br />
    </p>
    <ac:structured-macro ac:macro-id="5918df0b-de40-468d-b539-bdc458bfc967" ac:name="local-reporter" ac:schema-version="1">
      <ac:parameter ac:name="">@self</ac:parameter>
      <ac:rich-text-body>
        <p>
          <br />
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <p class="auto-cursor-target">
      <br />
    </p>
    <ac:structured-macro ac:macro-id="1c0bb109-7065-4f26-9d34-87a9dfcd0cee" ac:name="report-variable" ac:schema-version="1">
      <ac:parameter ac:name="name">rev</ac:parameter>
      <ac:parameter ac:name="value">%data:mytable &gt; reverse%</ac:parameter>
      <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
      <ac:rich-text-body>
        <p>
          <br />
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <p class="auto-cursor-target">
      <br />
    </p>
    <ac:structured-macro ac:macro-id="b23a771b-80c3-4d79-8f1f-1950a8ddac08" ac:name="report-body" ac:schema-version="1">
      <ac:rich-text-body>
        <p>Getting the second last entry from Table Data Macro:&#xa0;<br />
          <ac:structured-macro ac:macro-id="e2932c5e-7ae4-4c0a-aa21-1e374e196889" ac:name="report-info" ac:schema-version="1">
            <ac:parameter ac:name="">variable:rev &gt; 2 &gt;mytext</ac:parameter>
          </ac:structured-macro>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <p class="auto-cursor-target">
      <br />
    </p>
  </ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
  <br />
</p>

```

## Macro structure

You can recreate the example in the editor view:

![image](media://e41b71c2-be10-41f0-9282-6ee7a3cc4a56)

## Steps

1. Create a Table Data macro (from the Scaffolding app) with **Name**: `mytable` to create a dynamic table that allows users to enter data.
2. Inside the Table Data macro, create a table with one column and two rows and enter a title for the header row, for example, `Cities`.
3. In the second row, under the *Cities *column, create a Text Data macro (from the Scaffolding app) with the following parameters:
  - **Field Name**: `mytext`
  - **Type**: `line`
  - **Content**: `text`
4. Outside the Table Data macro, create a Report Block macro with **Injected**: selected.
5. Within the Report Block macro, create a Local Reporter macro with **Key**: `@self`.
6. Under the Local Reporter macro, create a Report Variable macro with the following parameters:
  - **Name**:** **`rev`
  - **Value**: `%data:mytable > reverse%`
7. Under the Report Variable macro, create a Report Body macro with the following text within its macro body:
8. Under the text within the Report Body macro body, create a Report Info macro with **Key**: `variable:rev > 2 >mytext`.