Remove grid condition based on user privileges

I have clients organized in workgroups. A user can only see the clients within their own workgroup (easily controlled in the grid sql stating “where workgroup = [grp_id]”). But if you are an administrator, you should be able to see all workgroups and all clients. That happens if you remove the where clause, but can’t come out with a good way to do it unless I actually have 2 grids and the correct one called based on admin privileges. Is there any way to make the sql more conditional? Case? If?


  1. In where statement add [glo_where]
  2. add a condition on Scriptinit if group=1 (admin) then [glo_where]=" workgroup >0" else [glo_where]=" workgroup =[grp_id]"

Oh perfect. I’ll get on it! Thanks so much.

Is that different than using sc_select_where(add)?

Different way same result.

1 Like

Another way to handle this is using a subselect clause in the WHERE clause.
where workgroup IN (select GroupID FROM AuthorizedGroupsTable where AuthorizedGroupTableUser - LoggedInUser)

Your admin would be authorized to all groups
Full Example…

employee_id, first_name, last_name
department_id IN (SELECT
location_id = 1700)
ORDER BY first_name , last_name;

I’ll see which works most efficiently. Thanks.