> For the complete documentation index, see [llms.txt](https://ieg4.gitbook.io/onevu-digital-platform/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ieg4.gitbook.io/onevu-digital-platform/onevu-control/data-silos/dynamic-content/in-section-visibility/if-last.md).

# If Last

### **Showing the last row in a collection**

As well as the method here:

{% content-ref url="/pages/-MgSnPNhPaWbaRYi0YOc" %}
[Arrays of data](/onevu-digital-platform/onevu-control/data-silos/dynamic-content/working-with-back-office-data/arrays-of-data.md)
{% endcontent-ref %}

It is  possible to show the first/last item in a collection using in section rules.

We’d recommend you do it this way because unlike the earlier method this one allows you to select multiple items from the first/last row of a collection in a simpler way.&#x20;

I.e. if we want to show the last row containing the four fields above we use:

{% hint style="info" %}
**#if** **@last**&#x20;
{% endhint %}

To illustrate this:

{{**#each**  TransactionDetail.Payments}}

{{**#if** **@last**}}

{{PostedDate}} - {{TransAmount}} - {{TransDescription}} - {{Reference}}

{{/if}}

{{/each}}

I.e. in the above it is saying find the rows available in the collection of payments. Find the last row and for this show the 4 fields of posted date, transaction amount, transaction description and reference.

If it was the first row it would be:

{{**#each**  TransactionDetail.Payments}}

{{**#if** **@first**}}

{{PostedDate}} - {{TransAmount}} - {{TransDescription}} - {{Reference}}

{{/if}}{{/each}}


---

# 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://ieg4.gitbook.io/onevu-digital-platform/onevu-control/data-silos/dynamic-content/in-section-visibility/if-last.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.
