9 Replies Latest reply: Mar 22, 2018 12:07 PM by Luke Reeve RSS

    Section Access to omit fields based on management structure

    Luke Reeve

      Hi All,

       

      Am struggling to get my head round a Section Access problem I have.

       

      I want the app to show every field for everyone except from 2 fields (FieldA and FieldB). What I want to achieve is if USERA does not manage USERB then Omit both fields. That way the user can only see those comments for someone who is directly in their team. I have a document which says USERAID managers USERBID but I have no idea how to get this in Qlik?

       

      I currently have a basic Section Access configured which excludes those fields from certain IDs but it does not cover the example above.


      Thanks

       

      Would appreciate any help!

        • Re: Section Access to omit fields based on management structure
          Luke Reeve

          On reflection I'm aware a little bit more info is needed.

           

          An example table structure would be:

           

          LeaderStaffFTESalary
          USERAUSER1115000
          USERAUSER2118000
          USERAUSER30.512000
          USERBUSER4126000
          USERBUSER50.823000

           

          Both USERA and USERB need to see all FTE information but should only be able to see the Salary info where they are listed as the Leader. Their Qlik login matches the Leader field.

           

          Thanks

          • Re: Section Access to omit fields based on management structure
            Luke Reeve

            Thanks for sharing the link Marcus.

             

            I've had a look and seems to match in principal what I need - but otherwise I think I'll need to re-evaluate the application design.

             

            Edit: Using the link I managed to achieve exactly what I needed. Thanks for sharing!

             

            Thanks

            • Re: Section Access to omit fields based on management structure
              Lauri Scharf

              I think I have a solution for you, where you declare a field in Section Access, then use that field in Section Application to limit access.

               

              The setup might be something like:

               

              Section Access;

              tblAccess:

              Load ACCESS, USERID, UPPER(USERID) as LEADER, OMIT

              From [your user list];

               

              Section Application;

              tblReduction:

              LOAD LEADER, STAFF_ANYONE, STAFF_LEADERONLY;

              SQL SELECT u.USERID AS LEADER, d.Staff as STAFF_ANYONE, case when u.USERID = d.Leader then d.Staff else NULL END as STAFF_LEADERONLY

              from [your user list] u

              cross join (select distinct Leader, Staff from [your leader-staff table]) d;

               

              tblSalaryData:

              Load Staff as STAFF_LEADERONLY, Salary

              From [your salary data];

               

              tblFTEdata:

              Load Staff as STAFF_ANYONE, FTE

              From [your salary data];

               

              The result of all this is that each LEADER can see anyone's FTE data, but only his/her employees' Salary data. It's all in the way the tables link together, starting with the LEADER field in the hidden table in section access. That links to LEADER in tblReduction, and then the two STAFF fields link from there to the two data tables.

               

              My underlying data reside in SQL Server, so I use CROSS JOIN to get the cartesian product of the two tables (so that every Leader can see every employee's FTE data). In Qlik, you can achieve the same with OUTER JOIN.