Tuesday, November 13, 2012

A Workaround Solution For QC Reporting According To User Groups

Sometimes QC's group functionality for the users may not sufficient for reporting. For example you may want to report some user actions accoriding to their team/department/divison.
To accomplish this type of report you have to create a group for evey divison/department/team. Also QC's group functionality is not effective for hierarchical teams.

You can use the siteadmin's user description area as a workaround solution for hierarchical team membering.


As you can see above screenshot you can writedown the user's hierarchical position into user description area from the siteadmin.

By using following view you can select his/her team/department/divison.



CREATE OR REPLACE FORCE VIEW <<<YOUR_SCHEMA_NAME>>>.GET_USER_HIERARCHY
(
   USER_NAME,
   DIRECTORATE,
   DEPARTMENT,
   TEAM,
   ROLE,
   US_IS_ACTIVE
)
AS
     SELECT user_name,
            directorate,
            department,
            team,
            role,
            us_is_active
       FROM (SELECT LOWER (user_name) user_name,
                    TO_CHAR (description) description,
                    SUBSTR (TO_CHAR (description),1,INSTR (TO_CHAR (description), '/', 1) - 1)
                       directorate,
                    SUBSTR (TO_CHAR (description),INSTR (TO_CHAR (description), '/', 1) + 1, (INSTR (TO_CHAR (description), '/', 1, 2)  - INSTR (TO_CHAR (description), '/', 1, 1)) - 1)
                       AS department,
                    SUBSTR (TO_CHAR (description), INSTR (TO_CHAR (description), '/', 1) + (INSTR (TO_CHAR (description), '/', 1, 2) - INSTR (TO_CHAR (description), '/', 1, 1)) + 1, INSTR (TO_CHAR (description), '/', 1,  3) - INSTR (TO_CHAR (description),  '/', 1, 2) - 1)
                       AS team,
                    SUBSTR (TO_CHAR (description), INSTR (TO_CHAR (description), '/', 1) + (INSTR (TO_CHAR (description), '/', 1,  2) - INSTR (TO_CHAR (description), '/', 1,  1)) + INSTR (TO_CHAR (description), '/', 1, 3) - INSTR (TO_CHAR (description), '/', 1, 2) + 1, LENGTH (TO_CHAR (description)) - INSTR (TO_CHAR (description), '/', 1, 3))
                       AS role,
                    us_is_active
               FROM qcsiteadmin_db_alm.users)
   ORDER BY 2, 3, 4, 5;

The query and the result will be similar to the following screenshot.


You can also query the users according to their directorate/department/team values. Hence this will make an easier way to list all the users those are in the specific department and you can query their actions.

No comments: