Iโve been using Appsheet for a month now so am still a noob. Itโs been going quite well for the most part. One issue that has me stumped is how to present an Enum list to the user based on their user role.
Hereโs a screenshot of the field setup. Basically I only want an Admin user to be able to select the last two options. I donโt mind if they are visible and unavailable to other users or if they are invisible to other users.
I tried using the Valid If field setting but then other users get an error message if it is set to one of the two Admin-only values.
I would also like the field not to be editable by non-Admin users if it is set to one of the last two values. Any pointers would be much appreciated.
How are you defining โadminโ versus non-admin? Is that data driven in a users table of some kind? There are a few options that could work here, but it depends on how your data is organized?
USERROLE() = โAdminโ
So you should likely go back to using the valid if field but you will want to add the current value in the field if you do not wish to display the error message to the non admin users.
So say your valid if is IF(USERROLE()=โadminโ, LIST(โStuffโ), LIST(โnon admin Stuffโ))+LIST([value]).
for the editable field you would want to know if the current value is apart of the admin only list. If this is small and static just do AND([value]<>โadmin value 1โ, [value]<>โadmin value 2โ)
If you want this to be dynamic then Iโll need to know how youโre creating these list to subject a solution.
What Austin said Hereโs an example with a STATIC version:
https://www.appsheet.com/samples/Built-from-your-app-spec-?appGuidString=a0843d68-260c-4bbe-8218-6fc...
Take a close look at the definition for the column called โCategoryโ.
And for the rest of the columns, you would want a edit-if, if
not(in([Category],{"Special Val A", "Special Val B"} ) )
If you want this to be dynamic and table driven, thatโs a bit harder. Maybe add new data tables into the app, and use the Intersect() function to combine them? E.g. a table with values for non-admins, and a second table with values for admins, etc.
Thanks Ty and Austin โ very helpful, that did it. (Itโs not a dynamic list so that makes it simpler)
One more question. I just attempted to set the โSpecial Val Aโ (one of the Admin only values) and I got this error message: "Value โBookedโ in field โReferral Statusโ cannot be converted to type Enum. https://share.getcloudapp.com/2Nu5jDNO
Hereโs a screenshot of the field setup:
Try to โturn onโ - Allow other value in enum type field.
Thank you for the suggestion. My concern with your suggestion is I do not want users to be able to add their own values to this field.
Why dont you just make 2 fields/Columns for this input. And make it visible only if user is admin. Make one with users values and one with admin values.
User | Count |
---|---|
43 | |
32 | |
25 | |
23 | |
14 |