1 Reply Latest reply: Jan 8, 2018 5:48 AM by kaan erisen RSS

    How to filter data based on logged in user? [Qlik Sense + Geo analytic]

    DILIP SOLANKI

      Hi All,

       

      We are loading data in our Qlik app through load script. Please find the sample tables scripts for reference:

       

      Geo Table Script

      GeoTableScript.PNG

       

      User Table Script

      UserTableScript.PNG

       

      User Permission Table Script

      UserPermissionTableScript.PNG

       

      STAR Schema as follows:

      Geo Table [Geo.Id] ------------ User Permission Table [Geo.Id]------------User Permission Table [Users.Id]------------Users Table [Users.Id]


       

      Sample data of above tables:

      Data Shot.png

       

       

       

       

      Now above script should run on some conditions like basis on logged in user access.


      Let's say User1 is accessing my app, as we have User1 in User Data.

       

      1. How to get logged in user details (username).

      I have tried using OSUser() and QVUser() but that is giving me Person/Me.


      I am expecting 'User1'.


      2. Once I got this logged in user details, I am trying to apply below condition in my script:


      SET vLoggedInUserEnterpriseId = $(QVUser); //assuming that it will give User1, looking for solution

      Now in user script I am planning to change query like:

      UserDataSCript.PNG

       

      So that above condition is returning me only those Geos which are accessible to User1.

       

      If I am implementing this scenario then it will not give exact solution, how to load data for each user if we place such conditions in script.

       

      Anyone know what is the best approach to achieve such a scenario? Any other way through which i can get logged in user related data.

       

      Is there any way where do not need to pass above condition in script and we can achieve our result.

       

       

      Thanks

      Dilip Solanki