> For the complete documentation index, see [llms.txt](https://docs.scaleflex.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.scaleflex.com/portals/portal-settings/datasets/connect-to-dataset/context.md).

# Context

Which dataset the list reads, and how its rows are ordered, grouped and addressed.

**Context** answers *which dataset, and how is it ordered and addressed?* It's the tab you always have to fill in — the [Criteria](https://docs.scaleflex.com/portals/portal-settings/datasets/connect-to-dataset/criteria.md) tab is optional.

<figure><img src="https://2536208400-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqsq2dR7Fjagf5eTifWZx%2Fuploads%2FzaMHn29TbGVvKfDYaxkk%2Fimage.png?alt=media&#x26;token=d84951c5-7eee-435e-bc20-98b8981d4a23" alt=""><figcaption><p>The <strong>Context</strong> tab of the connect dialog.</p></figcaption></figure>

## Dataset

The dataset this list reads. **Open the dataset in portal settings** opens it in a new tab — handy for checking a field name mid-setup, and a new tab so your unsaved settings here survive.

{% hint style="warning" %}
Switching to a different dataset **clears every other setting on both tabs**, keeping only **Items per page**. It has to: all of them name fields of the old schema, and carrying them over would leave a list whose grouping silently never fires and whose filter bar renders nothing, with no error to explain why. Pick the dataset first, then set the rest.
{% endhint %}

Everything below only appears once a dataset is chosen.

<div><figure><img src="https://2536208400-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqsq2dR7Fjagf5eTifWZx%2Fuploads%2F7kfUnJ9D1JVISY11TWaN%2Fimage.png?alt=media&#x26;token=87007715-fcc6-45de-b860-51808b5e6185" alt=""><figcaption><p>The <strong>Context</strong> tab filled in: the dataset, the order, and how rows are grouped.</p></figcaption></figure> <figure><img src="https://2536208400-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqsq2dR7Fjagf5eTifWZx%2Fuploads%2Fo4540TunUY1z3kt0Oyfm%2Fimage.png?alt=media&#x26;token=8ff267ea-28ee-4845-aab7-0fff5cfe94ad" alt=""><figcaption><p>The same tab scrolled down, to <strong>Row anchor</strong> and <strong>Items per page</strong>.</p></figcaption></figure></div>

## Sort by / Sort within a section, and Direction

The order rows come out in. **Direction** is **Ascending** or **Descending**.

The first control is named after what it's currently ordering, so it has two labels:

| You see                   | When                                                                                           |
| ------------------------- | ---------------------------------------------------------------------------------------------- |
| **Sort by**               | No grouping is set. It orders the whole list.                                                  |
| **Sort within a section** | A grouping is set. The sections follow the grouping, and this orders the rows inside each one. |

It's the same control either way. The list it offers is **three fixed orders, then one entry for every eligible field in your dataset** — so a dataset with a dozen text and date fields gives you a dozen more options here, each under its own label:

| Option                   | Orders by                                                                             |
| ------------------------ | ------------------------------------------------------------------------------------- |
| **Manual order**         | The order you dragged the rows into in the Items table. The default.                  |
| **Created date**         | When the item was added.                                                              |
| **Updated date**         | When it was last edited.                                                              |
| *then every field named* | Each **Text**, **Number**, **Date** and **Single choice** field, listed by its label. |

**Media**, **Rich text**, **Link**, **Yes / no**, **Multiple choice** and **Portal page** fields don't appear. None has a single comparable value to sort on, so they're left out rather than offered and silently ignored.

## Group into sections

Breaks the list with headings instead of running it as one stream. **Group by** picks the field; the kind of field decides what you get.

| Grouping field    | Headings                         | Order options                                 |
| ----------------- | -------------------------------- | --------------------------------------------- |
| **Date**          | A period — **Month** or **Year** | **Newest first** or **Oldest first**          |
| **Single choice** | One per option, with its icon    | **Option order** or **Reversed option order** |

**Option order** is the field's own order of options from the dataset's [Fields](https://docs.scaleflex.com/portals/portal-settings/datasets/fields.md) tab: the order you arranged them in, or A–Z if the field is set to **Alphabetical (auto)**. Keep a status field on manual order — it reads *Planned, In progress, Shipped*, and alphabetical would scramble it.

**Then group by** nests a second level inside the first — months, then categories within each month.

{% hint style="info" %}
Grouping and sorting are the same decision. Setting a grouping also sets the sort to the outermost grouping field, so rows arrive gathered rather than interleaved — and renames the control above to **Sort within a section**. Clearing the grouping hands the order back to **Manual order**.
{% endhint %}

## Show entries in the content tree

Lists every row in the page's content tree — the outline in the sidebar — under the same headings the list is grouped by. A changelog of two hundred entries becomes navigable instead of a scroll.

Two conditions:

* **The dataset needs a Text field.** The tree labels each entry with one. Without any, the switch is disabled and the dialog says so.
* **The page's layout has to show the content tree.** See [Layout](https://docs.scaleflex.com/portals/building-a-portal/layout.md).

With more than one text field, **Entry label** chooses which one names the entries.

## Row anchor

Which value addresses a single row in the page URL — so a link from anywhere else can land on one entry rather than the top of the list.

| Option               | Use when                                                                                  |
| -------------------- | ----------------------------------------------------------------------------------------- |
| **Generated anchor** | Almost always. Every item already has one, spelled from its first text field.             |
| *A text field*       | Your rows carry a code links are already written against — a reference, a product number. |
| **Not addressable**  | You don't want individual rows linkable at all.                                           |

An item can also override its own anchor under **Advanced → Link anchor** in the item form.

## Items per page

How many rows one page of the list shows; the rest are reached through the pager beneath it. **12**, **24**, **48** or **96**, and **12** by default.

They're all multiples of twelve so that a grid at any supported column count fills its last row instead of leaving a ragged one.

This is the one setting that survives switching to a different dataset — it names no field, so it stays put.
