I have two data types…
Users (contains a list of my users)
Groups (contains a group name and the users associated to it).
A users can belong to multiple groups.
I have created a screen to ‘add users to groups’ It all works fine but I am struggling to limit the add new user dropdown to only show users that are not in the group.
In terms of actions…
- you select a group
- it shows you a list of users in that group (using the email) - this is in a RG
- you click on add new user (an icon next to the group)
- a popup appears
- you select a user from the list and add.
- confirmation appears
- close popup.
All is good but I want 5. to only show users (from the user table) that are not already in the group (group table). Not sure how to write the syntax for this.
Option 1- Just use the User Data Type:
Add a field in the User Type called “UserGroups” which of type “Groups” and make it a list. The in your data source for the drop down, add a constraint when “UserGroups doesn’t contain this group”.
Option 2 - Use the Group Table:
Change the data source of your drop down to use the existing group table. Then for your data source in the dropdown, search for groups users :unique elements with constraint when “group is this group”.
One more option (and only because I was thinking through it at the same time when @SerPounce responded)… assuming you have a list of users on the group, you could have the data source of your dropdown be a search for users with an advanced filter (
Search for Users:filtered and then select the
Advanced option for the constraint) where this group’s users list doesn’t contain this user.
thanks for this and I think option 2 sounds best with least modifications to existing tables - but confused (doesn’t take much!) as to what entries i should be entering.
What should I put in the following…
Type of choices…
— and what Type/constraints should be…
Just for confirmation the users table has a list of all users in it - if in a group or not. In the groups table we have multiple groups in it (all with unique ID) and then multiple users for each group.
Def think this is the best solution just not sure how to get this working.
so if the group table looked like this
group name. useremail
group 1. [email protected]
group 2. [email protected]
group 1. [email protected]
and the user table looked this this
useremail. first name. last name.
[email protected]. john. smith
[email protected] harry. jones
[email protected]. phil. jackson
I would want the dropdown on group 1 to only show [email protected] but the dropdown on group 2 would show [email protected] and [email protected]
I am nt sure what the syntax would look like though based on your comments (not your explanation more my understanding )
Hey there, @p_clavering… it was clear in your original post what you want the dropdown to do… what wasn’t clear was your data structure. Based on your latest response, it looks like you are creating a new thing in the
Groups data type every time a user is added to a group, right? If that’s the case, then option 1 from SerPounce and my option won’t work for you because they are based on one of your data types having a list.
With my option, your
Group data type would be set up like this…
So, instead of creating a new thing in the
Group data type every time a user is added to, say, Group 1, you would make changes to a thing (Group 1), and you would add the user to the group’s list of users. With that data structure in place, you would configure the
Data source for your dropdown the way I proposed in my previous response.
With the way you have it set up now, you would have to search through every row in the
Group data type to find the records that are associated with Group 1 and then come up with a list “on the fly” of the users who are in that group so you can exclude them from the dropdown. So, in other words, what I am saying (and I think what SerPounce might say, too), is that you really should use a list.
never used lists so will have a look at this… sounds much more logical and efficient!
ever day is a learning day right
this is amazing and worked a treat - thank you - that would have taken me months to work out