Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
bradmahan
New Contributor

Partitioning Users based on User/Password

Hi everyone,

I'm working on developing a Qlikview app that we want our distributors to be able to access. Obviously we only want them to see the data for themselves and not be able to compare their numbers to each other. I am new to Qlikview and tried to figure out my problem from what others have posted online, but I'm not having much luck. The following is the general format I have in my applications edit script:

Section access;

LOAD   ACCESS,

   UPPER(USERID) AS USERID,

   UPPER(PASSWORD) AS PASSWORD,

   REDUCTION

FROM   SelectionAccess.QVD (qvd)

WHERE   1=1;

LOAD * INLINE [

ACCESS, USERID, PASSWORD, REDUCTION

ADMIN, ADMIN, PASSWORD, <ALL>

BUSINESS USER, SALES, PASSWORD, <ALL>

DISTRIBUTOR, DIST1, PASS1, DISTRIBUTOR NAME

DISTRIBUTOR, DIST2, PASS2, DISTRIBUTOR NAME

DISTRIBUTOR, DIST3, PASS3, DISTRIBUTOR NAME

];

I would like for each distributor to see everything that is designed in the user interface, but limited only by their distributor name (which is a field in the application).

Please help, thanks!


3 Replies
Partner
Partner

Re: Partitioning Users based on User/Password

Your code looks pretty good.  A couple of things that pop out.

A note on the ACCESS field:  There are only two supported values ADMIN and USER so users Sales, Dist1, Dist2 and Dist3 would all be USER.

The Reduction field is how you are going to reduce your data and must be connected to your data model.  I would assume that you would have different Distributor Names rather than all being the same.  In your current script all distributors would see the same value.  I like to use codes instead of names, just in case there are differences in how a user typed a distributor name.

Besides those points I think your script looks fine.

Good luck

Oscar

bradmahan
New Contributor

Re: Partitioning Users based on User/Password

Oscar,

I went ahead and changed the script and although I am no longer getting an error message when I log in as one of those users the QlikView dashboard is still showing all distributors data. For example, when I log in with DIST1|PASS1 I am still seeing data for DIST2 and DIST3. Here is a copy of the updated code (please note actual distributor names have been changed per my company's privacy policy).

Section access;

LOAD ACCESS,

   USERID,

   PASSWORD,

   REDUCTION

FROM [..\QVD\SectionAccess.QVD] (qvd)

WHERE 1=1;

  LOAD * INLINE [

  ACCESS, USERID, PASSWORD, REDUCTION

  ADMIN, ADMIN, PASSWORD, <ALL>

  USER, BUSINESS, PASSWORD, <ALL>

  USER, USER1, DIST1, DISTRIBUTOR NAME 1

  USER, USER2, DIST2, DISTRIBUTOR NAME 2

  USER, USER3, DIST3, DISTRIBUTOR NAME 3

  USER, USER4, DIST4, DISTRIBUTOR NAME 4

  USER, USER5, DIST5, DISTRIBUTOR NAME 5

  ];

Distributor Names are brought in through a separate spreadsheet and I used an Inner Join between the Section Access and Distributor Names table in the data model.

Please advise.

Partner
Partner

Re: Partitioning Users based on User/Password

Brad,

Ok, everything looks good.  You've got you're connection to the data using your Reduction field.

Did you check your Document properties?

275467.PNG

You'll want to go to your opening tab and select Initial Data Reduction Based on Section Access.

(Don't forget to make a backup copy)

Good luck!

Oscar