I am using the users config for to filter users view, however i not wanted to allow what user modified yours config, wanted to allow the user to select only once.
You want to create an functionality where the user can see & update his/her own data only?
Almost this, I want to create a feature that the user only sees the data of your company, so when he selects your company in the user settings, I prevent it from changing that choice.
So… you would like to select the company from the list (using Usersettings) and when that’s done, you can’t change it anymore with that same device?
What if your user selects the wrong company? He would be viewing other company data (is this a problem?), and also have no way of fixing it.
Exactly that, do you help me?
So I want to do this and leave the user on alert, if he selects wrong it will be necessary to create a new user.
Rather than having the user select his/her company to view, is there a way to tie to users email to the “proper” company assignment so errors are not made? I am not clear on your use case, but was thinking an access table might create a better experience?
User email … Company
Following @Mike. No need to choose anything then… the email address would do that job.
By what I understood this would be done through a certain business domain? But some of the companies do not contain these business emails are just physical people!
If your use case is a limited set of companies to select from, and the users must be associated to a particular company, you could maintain a simple user email list with associated permitted company. You can then use a slice with ShowIf to only show records associated with that users linked company.
This works well when:
- the company list to choose from is known and
- You can pre-assign a user to a company.
Again, without really knowing your actual use case it’s a bit hard to make a good recommendation.
If you want an arbitrary user to select a single company, without any predefined control over what they can select, then you could also store that selection in the “settings” table as a preference. I just doubt that is what you really want?
But I do not know who the users are going to use, I only know the companies:
So what I’m trying to do is be able to separate the data of each vendor for their particular companies.
For example: I have company X and company Y, company X can only see the sales of its own sellers but can not see the sale of the sellers of company Y;
What i was trying to do is that when the business owner selects his name in the settings, he will not be able to change his choice. So I compare USERSETING () with the company name of each seller selected on your sale.
Don’t use user settings. Instead, use a normal table, one row per user, and record the user’s choice there when the row is added. The following Editable_If expression prevents changes after an initial save:
NOT(IN([_THISROW], FILTER("MyTable", TRUE)))
MyTable with the name of this table.
Okay, but how do I select a column from the “MyTable” table?
In all likelihood, the MyTable (or whatever you call it) table will use the user’s email address (from USEREMAIL()) as the key column value (e.g., email). You can use LOOKUP() to find the current user’s row and get the user’s chosen company name:
LOOKUP(USEREMAIL(), "MyTable", "email", "company_name")
MyTable is the name of the table,
company_name is the name of the column containing the user’s company choice.
Thank you very much, it helped me a lot.