Forum Discussion
MarkShnier__You
5 years agoQrew Legend
Brittany,
Even for an experienced user, that is a very interesting question, so no apologies for being new to Quick Base.
There is a recent enhancement we got in the form of a new function which allows, for the first time, for a formula to "see" the User's Role. Previously only form Rules could do that.
The function's Help is here. It's a bit confusing to understand the Help but the examples help.
https://login.quickbase.com/db/6ewwzuuj?a=dr&r=gj&rl=dme
If you use the function UserRoles("ID") and the user was in Roles # 10 and #11 (you get the number by clicking on the role name and observing the URL), then the function would return 10 ; 11
ie the Role numbers separated by space ; space
You can also get the names to return with
UserRoles("Name") which would return
Participant ; Administrator
or UserRoles("") will return
11/Participant ; 12/Administrator
The advantage of hooking onto the number of the Role is that if you change the name of the Role it will not break your formula.
The disadvantage of a number is that it's a bit of a pain to parse out.
But in practical terms the roles will start to number at 10 (so at least two digits) and heck, if you create an app with more than 99 Roles, you deserve what you get. So let's assume you have a two digit Role.
So, with that long preamble here is your answer for say a formula checkbox field called perhaps
[Is a Team Lead?], where the Role ID# of a Team Lead was 12.
IF(Contains(UserRoles("ID"),"12"),true)
Then just run your report filter where that field is unchecked.
​​​
------------------------------
Mark Shnier (YQC)
Quick Base Solution Provider
Your Quick Base Coach
http://QuickBaseCoach.com
mark.shnier@gmail.com
------------------------------
Even for an experienced user, that is a very interesting question, so no apologies for being new to Quick Base.
There is a recent enhancement we got in the form of a new function which allows, for the first time, for a formula to "see" the User's Role. Previously only form Rules could do that.
The function's Help is here. It's a bit confusing to understand the Help but the examples help.
https://login.quickbase.com/db/6ewwzuuj?a=dr&r=gj&rl=dme
If you use the function UserRoles("ID") and the user was in Roles # 10 and #11 (you get the number by clicking on the role name and observing the URL), then the function would return 10 ; 11
ie the Role numbers separated by space ; space
You can also get the names to return with
UserRoles("Name") which would return
Participant ; Administrator
or UserRoles("") will return
11/Participant ; 12/Administrator
The advantage of hooking onto the number of the Role is that if you change the name of the Role it will not break your formula.
The disadvantage of a number is that it's a bit of a pain to parse out.
But in practical terms the roles will start to number at 10 (so at least two digits) and heck, if you create an app with more than 99 Roles, you deserve what you get. So let's assume you have a two digit Role.
So, with that long preamble here is your answer for say a formula checkbox field called perhaps
[Is a Team Lead?], where the Role ID# of a Team Lead was 12.
IF(Contains(UserRoles("ID"),"12"),true)
Then just run your report filter where that field is unchecked.
​​​
------------------------------
Mark Shnier (YQC)
Quick Base Solution Provider
Your Quick Base Coach
http://QuickBaseCoach.com
mark.shnier@gmail.com
------------------------------
- BrittanyScheid5 years agoQrew CadetThanks! One question, is there a function/way to check the role assigned to a specific user? Like could I run a function on the Reviewer field (which is a user field) to find out what role they are assigned to? Thanks!
------------------------------
Brittany Zane
------------------------------- MarkShnier__You5 years agoQrew LegendHmmmmm, no I do not think there is a way. The only way, is to have a table of users to use in relationships to lull down the user. Then you can add any other fields to that table to be looked up down to the detail records.
------------------------------
Mark Shnier (YQC)
Quick Base Solution Provider
Your Quick Base Coach
http://QuickBaseCoach.com
mark.shnier@gmail.com
------------------------------- DanielJohnson24 years agoQrew TraineeHey Mark,
Do you know if it's possible to add multiple conditions to that IF statement in the formula checkbox field? I'd like it to be true for 3 roles.
Thanks,
Daniel
------------------------------
Daniel Johnson
------------------------------