Database view on user table with active = true condition is not working

sath
Tera Expert

Hi,

 

We want to implement a database view for below requirement:

Active users in active groups that has a role, preferable not inherited ones.

When database view is created for this, it shows inactive users too. Created a database view with on user table with just active = true condition, it it still showing all the records. Can you anyone please assist?

Screenshot 2025-08-06 at 1.09.24 PM.png

1 ACCEPTED SOLUTION

Brad Bowman
Kilo Patron
Kilo Patron

Database views are meant to join two or more tables.  It is possible to self-join which is useful in some cases, but that's not what you want to do here.  This will get you started on showing active users in active groups, joined with the user role table

BradBowman_1-1754506397839.png

If you grant roles to groups you'll want to include the sys_group_has_role table instead or also.

 

 

View solution in original post

3 REPLIES 3

Its_Azar
Tera Guru

Hi there @sath 

 

Database view filters (the “Where clause” in your screenshot) are not enforced at runtime when querying the view. They only help optimize the view when joining large tables, but do not act as actual filters for the output. try to If you're using the view in a report/UI, consider adding a calculated/flag field or writing a scripted view that only includes the logic you want (active users + active groups + role checks).

 

 

If this helps kindly accept the solution thanks.

☑️ If this helped, please mark it as Helpful or Accept Solution so others can find the answer too.




Kind Regards,

Mohamed Azarudeen Z

Developer @ KPMG

 Microsoft MVP (AI Services), India

Brad Bowman
Kilo Patron
Kilo Patron

Database views are meant to join two or more tables.  It is possible to self-join which is useful in some cases, but that's not what you want to do here.  This will get you started on showing active users in active groups, joined with the user role table

BradBowman_1-1754506397839.png

If you grant roles to groups you'll want to include the sys_group_has_role table instead or also.

 

 

sath
Tera Expert

@Brad Bowman   Thank you!