Filter entities according to user group

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

This will probably be relevant to you soon

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 (or 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)

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

You should be able to access the username in the form by adding a field username

But are you defining the username value in the App User QR that you provide to the monitors? If not this will be blank 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.