> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloneable.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Show dropdown options by location

> Offer each field crew only the choices that apply where they are working

Some choices depend on where the work is. An anchor that is standard in one market is wrong in the next. You can make a dropdown offer only the options that apply at the object's location, on the web and in the iOS app.

It takes two things:

* A **dataset** with one row per option, and a column holding the area each option applies to.
* A **filter by this record** on the field, which keeps the rows whose area contains the object's location.

## 1. Build the dataset

A dataset is a custom type with rows. Give each row:

| Column | What it holds |
| - | - |
| `key` | The value that is stored, for example `MR2-3/4` |
| `label` | What the crew sees (optional) |
| `area` | Where the row applies, as a GeoJSON Polygon or MultiPolygon |
| anything else | Columns you want to filter or narrow by, such as `market` or `max_guy_size` |

One option that applies in two markets is two rows, one per area. Coordinates are longitude first, the GeoJSON order. Keep boundaries simple: tens or hundreds of points per area is plenty.

You can paste rows as JSON or CSV when you create the dataset from a field. In CSV, put the area's GeoJSON in quotes.

## 2. Point the field at the dataset

1. Open the template and select the field.
2. Open **Options**. Under **Or narrow from a catalog dataset**, choose the **Dataset**.
3. Pick the **Stored column** (`key`) and, if you have one, the **Shown column** (`label`).

## 3. Add the filter

1. Under **Filter by this record**, click **Add a filter**.

2. Under **How to write expressions**, choose **Offer the rows whose area contains this record** and click **Use**. It inserts:

   ```js theme={null}
   rows.filter(r => !json.location || within(json.location, r.area))
   ```

3. Describe it in **What this does**, for example "Anchors for this market".

4. Under **Try it**, enter a latitude and longitude, click **Run**, and check how many rows are offered.

5. Click **Apply**, then save the template.

The `!json.location ||` part offers every option until the object has a location. Leave it out if crews should place the object first.

## Narrow further

The filter is plain JavaScript, so it can combine the location with other answers on the same object. For example, to also respect a guy size:

```js theme={null}
rows.filter(r =>
  (!json.location || within(json.location, r.area)) &&
  (r.max_guy_size == null || Number(data.guy_size) <= r.max_guy_size))
```

You can also add **steps** after the filter. The crew then narrows the filtered rows one column at a time.

## What crews see

![Anchor material picker on iOS listing one option](https://mintcdn.com/cloneable/D8FnbMiXuI0nul9Z/images/forms/options-by-location-ios.png?fit=max\&auto=format\&n=D8FnbMiXuI0nul9Z\&q=85\&s=3a24e9915ec6e826449dc38bf44ec3ab)

On the phone, a guy in Cleveland is offered only the Cleveland anchor

* Only the options that apply at the object's location.
* If nothing applies, the field says "No values apply to this record". A value saved earlier can be removed with **Clear**.
* If a saved value is not offered at the object's current location, it stays and the field asks for a new pick. Nothing is cleared for you.
* Without steps, crews pick from the whole filtered list, however long it is.

> [!NOTE]
>
> Crews need an iOS app version that supports filtered dropdowns. Older versions show every option.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.