Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Trouble with section access

I've been trying to create a section access rule for SalesReps to only see their data. I can't seem to get it to work. What am I doing wrong?

SR:

LOAD

    SalesRep,

    Data

FROM [lib://Path To My File.xlsx]

(ooxml, embedded labels, table is Sheet1);

SalesRep:

LOAD UPPER(SalesRep) as SALESREP, Data

Resident SR;

DROP TABLE SR;

Section Access;

LOAD * inline [

ACCESS, USERID, SALESREP

USER, DOMAIN\NAME, DOMAIN\NAME

USER, DOMAIN\NAME, DOMAIN\NAME

];

section application;

8 Replies
sinanozdemir
Valued Contributor III

Re: Trouble with section access

Hi,

The below works for me:

Capture.PNG

Although, in your case, there is no password so the userid will be visible. Also check to make sure that the below check boxes are checked in the document properties:

Capture.PNG

Not applicable

Re: Trouble with section access

This is Qlik Sense, sorry I should have clarified in my description

Re: Trouble with section access

Employee
Employee

Re: Trouble with section access

Hi couple of things

- The Section Access should be at the start of the script. The actual data load must come after the 'Section Application' line, which iteself comes after the section access table load

- Log into the hub and 2x check the userid that the hub is giving you. In the attached screenshot my ID would be:

QTSEL\JPE

Capture.PNG

- i'm not sure what the data values are for your SALESREP FIELD.  If they are the same as USERID then you would use something like the following below

-although not necessary i think you can do the upper() in one load without the resident load. The whole script would look like this:

Section Access;

LOAD * inline [

ACCESS, USERID, SALESREP

USER, QTSEL\JPE, QTSEL\JPE

USER, QTSEL\ABC, QTSEL\ABC

];

section application;

SR:

LOAD

    upper(SalesRep) as SALESREP,

    Data

FROM [lib://Path To My File.xlsx]

(ooxml, embedded labels, table is Sheet1);

Not applicable

Re: Trouble with section access

So my SalesRep field is identical to USERID, and even when I format it the way you have it I still see every salesreps data.

Employee
Employee

Re: Trouble with section access

Can you post your script , screenshot of userid (like mine above) ?

I'll run a couple of tests myself to confirm. Could be that it wants the back slashes as forward slashes in the userid field but I'd like to test first.

Employee
Employee

Re: Trouble with section access

My tests are showing that the date is not reduced when the value in SALESREP has an '\' in it.

If you change the data values to not include a '\' it works. See the changes to section access values under SALESREP below as well as a purgechar() function in the data load to remove the '\' . I'll see if i can find out why this is needed.

Section Access;

LOAD * inline [

ACCESS, USERID, SALESREP

USER, QTSEL\JPE, QTSELJPE

USER, QTSEL\ABC, QTSELABC

];

section application;

SR:

LOAD

    purgechar(upper(SalesRep),'\') as SALESREP,

    Data

FROM [lib://Path To My File.xlsx]

(ooxml, embedded labels, table is Sheet1);

Employee
Employee

Re: Trouble with section access

Couldn't find anything on it. I logged with support. I suggest making the change to a dash or something instead of a slash and going with that. Hope it helps. Let me know if the dash doesn't work.