# Filter entities according to user group

**URL:** <https://forum.getodk.org/t/filter-entities-according-to-user-group/56444>\
**Category:** Support\
**Tags:** odk-xlsform\
**Created:** [August 27, 2025, 1:24am UTC](https://forum.getodk.org/t/filter-entities-according-to-user-group/56444 "2025-08-27T01:24:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sebtux](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/sebtux/32/14658_2.png) [@sebtux](https://forum.getodk.org/u/sebtux)\
**Post date:** [August 27, 2025, 1:24am UTC](https://forum.getodk.org/t/filter-entities-according-to-user-group/56444/1 "2025-08-27T01:24:21Z")

</div>

**What is the issue? Please be detailed.**

I’m designing a follow-up form to log visits to farms. I loaded an entity list of farms to ODK Central, which have an attribute called “zones”. These zones must be assigned (filtered) to specific groups of monitors. What I can’t figure out is how to filter these zones by using the monitor’s usernames.

**What have you tried to fix the issue?**

I tried filtering zones through a choice-list that related zones and monitors but it didn't work.

Maybe I should use another entity list for the monitors and the zones they’re supposed to work on?

Thanks in advance for your guidance,

–

seb

---

<div class="post-metadata">

**Author:** ![ahblake](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ahblake/32/22392_2.png) [@ahblake](https://forum.getodk.org/u/ahblake)\
**Post date:** [August 27, 2025, 1:51am UTC](https://forum.getodk.org/t/filter-entities-according-to-user-group/56444/2 "2025-08-27T01:51:22Z")

</div>

This will probably be relevant to you soon

> [@Limiting Entity access for App Users and Data Collectors](https://forum.getodk.org/t/limiting-entity-access-for-app-users-and-data-collectors/54386/18):
>
> Thanks again to everyone who shared feedback on our earlier exploration of limiting Entity access in Central. In that post, we outlined a phased approach: Single ownership: Users can see all Entities or only those they’ve created. Single ownership with changeable owners: Project Managers can reassign Entities. Group ownership: Users can be assigned to groups to access shared Entities. Based on your feedback, technical considerations, and the variety of use cases we’ve seen, we’ve dec…

But for now, I think you are on the right track, to assign a field against your monitor's usernames (choice list / csv / entity list) as the zone(s) applicable as a space delimited array and use a [`selected`](https://docs.getodk.org/form-operators-functions/#selected) (or [`contains`](https://docs.getodk.org/form-operators-functions/#contains), but more risky with unintended matches) expression in your choice filter to prune the farm list down to those with matching zone(s).

Once the username is selected (or entered and matches an item in the list), the zones can be determined with an instance lookup as part of the selected expression in the choice filter `selected(lookup, zones)`

---

<div class="post-metadata">

**Author:** ![sebtux](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/sebtux/32/14658_2.png) [@sebtux](https://forum.getodk.org/u/sebtux)\
**Post date:** [August 27, 2025, 2:19am UTC](https://forum.getodk.org/t/filter-entities-according-to-user-group/56444/3 "2025-08-27T02:19:11Z")

</div>

> [@ahblake](#):
>
> Once the username is selected (or entered and matches an item in the list), the zones can be determined with an instance lookup as part of the selected expression in the choice filter `selected(lookup, zones)`

Hi, is it possible to catch the username from ODK Collect and use it in a choice-filter with duplicated values? (because each zone has more than one monitor assigned)

–

seb

---

<div class="post-metadata">

**Author:** ![ahblake](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ahblake/32/22392_2.png) [@ahblake](https://forum.getodk.org/u/ahblake)\
**Post date:** [August 27, 2025, 3:03am UTC](https://forum.getodk.org/t/filter-entities-according-to-user-group/56444/4 "2025-08-27T03:03:35Z")

</div>

You should be able to [access](https://docs.getodk.org/form-question-types/#metadata) the username in the form by adding a field `username`

But are you defining the [username value in the App User QR](https://forum.getodk.org/t/how-to-customise-qr-code-settings-to-include-username/47078) that you provide to the monitors? If not this will be [blank](https://docs.getodk.org/collect-settings/#form-metadata-settings) in Collect. This is different to the _display name_ for the app user but you might want them to be the same value.

You'd also need to build your _list_ of usernames to match the usernames assigned to the app users.

I don't think you need to add `allow_choice_duplicates` to `settings`, you ought to be able to put a space separated list of _zones_ against the _username_ (one entry per user), and the list of **farms** with matching **zones** will filter accordingly (one entry per farm)

username1 might have the zone column as `zone1 zone3 zone99`, username2 might have `zone1 zone99 zone 4` and username2 has `zone2 zone3`. So a farm `farmA` with a value of `zone1` against the zone column should appear for username1, username2 but not username3 when you use the selected function as a choice filter.
