Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Oracle Apex filter select list query based on roles

VinipandaMar 30 2021 — edited Mar 30 2021

I need to modify a select list mentioned for page item in my application.
Currently it displays the departments available.
Select dept_name as d,dept_id as r from depts;

Now i need to modify filter such that, when user role is admin it should see all departments.

And if it is User, it will see only departments it is a part of inroles. Admin is part of all depts so admin would see all departments.

Userrole table:
image.png

Role table:
image.png

userrole.role_id=roles.id
userrole.user = :APP_USER
The dept_id column is populated from shuttle item, so in app the role allocation is done department wise So user can select multiple departments.
As a result departments are stored in colon separated format so this also needs to be handled in query.

So the query should be such that, when user is admin , all departments should display and if it is user, it should be departments from the userrole table.

The department id in lov select query is equal to the ones in user role.

Apex 20.2

Comments
Post Details
Added on Mar 30 2021
1 comment
1,044 views