- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2017 03:07 AM
Hi guys,
I would like to count the number of users with at least one role on table [sys_user]. How can I achieve that?
I filtered "roles is anything" and get no results at all.
I should at least get 10 users with role(s).
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2017 04:06 AM
Hi Denis,
There is a table called 'User Roles' (sys_user_has_role) which shows all records where a user has a role / n-number of roles. Simply 'group by' on the User field to provide you with the info you require. (Number of users with role(s) assigned).
In the example below you can see there are 4894 records (where a user has a role - obviously a user can have more than one role which is included in the overall result set), however if I group by the user field, I can see I have 688 unique User records with the respective role(s).
Thanks, Robbie.
Please mark this question correct and helpful to help close out open questions on the community.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2017 04:02 AM
Hi,
I believe if the roles are provided through groups this filter might not work. You can directly open User Roles(under User Administration) and see all the users has roles grouped by each role.
Regards,
Karthik Nagaramu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2017 04:06 AM
Hi Denis,
There is a table called 'User Roles' (sys_user_has_role) which shows all records where a user has a role / n-number of roles. Simply 'group by' on the User field to provide you with the info you require. (Number of users with role(s) assigned).
In the example below you can see there are 4894 records (where a user has a role - obviously a user can have more than one role which is included in the overall result set), however if I group by the user field, I can see I have 688 unique User records with the respective role(s).
Thanks, Robbie.
Please mark this question correct and helpful to help close out open questions on the community.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2017 06:50 AM
Thank you Karthik and Robbie.
Your idea works perfectly Robbie. I have marked your answer as correct, right?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2017 07:40 AM
Hi Denis, You haven't marked my post correct yet unfortunately, or not what I can see?
Please open your post via this link(filter users with roles ) and click Correct. Thanks Denis - appreciate it and glad to help.
Thanks,
Robbie