Hello everybody!! I need a little help with my APP.
I have a google sheet where all the cars of my company are entered.
The cars are found in different cities around Italy.
the application is used to make a periodic checklist of cars.
Data entry is done every day by 3 people who are in different cities. I have created an account for each employee.
What I would like to do is show each employee only their own list of cars in their city. How can I solve?
Another idea would be to have a UsersTable and on of the fields of each User can be Assigned Cars made using an EnumList column of basetype Ref. I use this approach for multi-company or multi-role apps
Thanks everyone for the help !!
so I created a âUSERâ tab with name, surname, email, and station of belonging.
I did not understand the security filter should I insert it in the âDBâ table? where are all the machines in Italy marked ?.
Example if User Francesco has to view only the cars present in ROME.
In the âUserâ table I entered Francescoâs name, with his email and in the Station column I wrote Rome.
How should I do the formula for the filter?
If you need more information, just ask
Thanks again!!!
The article I provided should give you the details you need to understand Security Filters. They are placed in the AppSheet Table. AppSheet will try to apply them at the database level, if appropriate.
Since it appears you are wanting related cars to the people by city/area, then the expression will need to be slightly different.
Itâs not clear how you identify what city a User is assigned. Iâll assume that is what âstation of belongingâ is? Maybe you assign the city here, e.g. Rome. I will also assume only a single city can be assigned.
I will also assume that you have a similar column in your cars table to know what city/are they are in - letâs say itâs called Location.
With above in mind the Security Filter for the Cars table simply needs to find cars that match the city of the logged in userâŚlike this:
[Location] = ANY(SELECT([Station of Belonging], [Email] = USEREMAIL()))
This expression is placed in the Security Filter of the Cars table in AppSheet
Hi, Im sorry but I canât get there, could you give me a hand?
The sheet of the first image is called âDBâ inside there are all types of machines, the station column is where the cars are placed.
In the second image I have created another âuserâ sheet where I have the data of who has to access and see only their own station.
A thousand thanks
Sorry, I missed including the SELECTâs table name in my sample expression which might be confusing you. Here is the modified expression based on your details:
Thanks a lot it works perfectly !.
One last thing if you can, and what if you want a user to view two stations at the same time?
itâs possible?
I donât want to steal any more time
Thanks again
If you change the Station column for the user to an EnumList to allow assignment of one or more locations, then your Security filter expression only needs to change slightly to this:
Now, taking all of the above one step further. If you wish to allow access to ALL data to certain users, you could just select all locations in the Station column. There is a âSelect ALLâ option in an EnumList dropdown.
But I think you may be referring to a manager or admin type person so I recommend building into the Security filter a bypass for these certain users that can be used across several tables - not just this one. Using the examples above AND assuming you are identifying users who need ALL access by their email, You could change the Security Filter like this:
Eventually youâll get tired of trying to manage the email lists in the Security Filters. A better way is to assign a Role, a new column, to each user in the Users table. For users who need to see all data maybe you assign them the role of âManagerâ. Then the Security Filter could be:
I am suggesting a new Role column as opposed to an option within the Station list because you will likely want to give this âAll Accessâ capability in other tables within your app - maybe not now but likely later.
Expression âOR( IN(âManagerâ, ANY(SELECT(User[Role], [Email] = USEREMAIL())), IN([Station], ANY(SELECT(User[Station], [Email] = USEREMAIL())) )â was unable to be parsed: Number of opened and closed parentheses does not match.
Iâll let @WillowMobileSys respond to that one, I suspect it is because [Station] is a list and so you probably need to use Intersect() rather than In()
I agree it is probably something with how the [Station] columns are defined. Can you show us how you have defined the [Station] column in both the DB and User tables?
The issue is that in your User table both Station and Role are defined as Text. The Security Filter is assuming these are Lists - EnumLists.
You had said earlier that you wanted to be able to assign multiple Stations to a single User.
I had introduced the idea of Role but I probably failed to mention that it is a good idea to plan for a user being assigned multiple Roles.
If you wish to support these concepts you will need to update the column types and add values to choose. Let me know if you make any of the suggested column changes.
For now, based on your current column definitions, the Security Filter expression should be: