Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
richard_cioci
Creator
Creator

Using section access to limit access to specific sheets

I've looked all over the qlik community and am having trouble setting up sheet access based on user names which are being used in section access. A lot of the people refer to listing out possible users in the conditional show property of the sheet which is being hidden or shown but I can't accept this as a solution that is either practical to maintain or one that is congruent with the scalability of qlik new itself.

I Have found perhaps two posts about linking section access to a table within the section application area, classifying ntnames as specific types of users and then seemingly setting variables to 0 or 1 based on that second table and then setting the sheet's conditional show to look at that variable.

I Tried this a number of ways and while it works on the desktop version, the server side version doesn't seem to work, it has no data for me to view. I found a very scarce post saying that the reload service should not be included when detailing the sheet permissions in section application, so then I tried it that way and the reload failed but the logs don't say why.

is there a simple way to show or hide sheets based on the structure already setup by section access? If so, what am I doing wrong?

1 Solution

Accepted Solutions
richard_cioci
Creator
Creator
Author

Ok, so I finally got it to work, didn't take that many more steps. I thought I'd post it here for other people since some solutions can be confusing or spread over several replies. My issue was that rather than giving the Qlikview reload service the role with the highest permission, I had to give it an * to get access to all roles, even though the highest permission role should give access to all sheets (not sure why it didn't work the other way).

I'm sure there are other ways to do it, but this seemed like the easiest to manage for me.

So you start with your regular Section Access coding in the hidden script:

Section Access;

LOAD ACCESS,

     NTNAME,

     SAREP,

     NM

FROM

'..\..\..\Dashboard\SectionAccess.xlsx'

(ooxml, embedded labels, table is SA);

Then you add the sheet access coding directly underneath

Section Application;

Sheet_Security:

LOAD USERS as NM,

     SH01,

     SH02,

     SH03,

     SH04,

     SH05,

     SH06,

     SH07,

     SH08

FROM

'..\..\..\Dashboard\SectionAccess.xlsx'

(ooxml, embedded labels, table is SHEETS);

My Section Access table looks like you would expect and the NM column is to specify their role, MGR or NON for different sheet access, i.e.

NTNAME   SAREP   NM

him            Richard   NON

her             Mike       NON

mgr1           *            MGR

mgr2           *            MGR

and the Sheets Table looked like so:

USERS  SH01  SH02  SH03.... SH07 SH08

NON         1         1         1           0        0

MGR         1         1         1           1        1

Then set the condition property for each respective sheet to show if the flag for that sheet is 1, i.e.:
SH08=1

Then reload!

This allows you to simply switch roles under NM in the main Section access table, and easily switch which sheets are accessible to entire groups of users. It also prevents having to maintain a list of all necessary users in the condition formula for each sheet.

Hope this helps!

View solution in original post

3 Replies
Anonymous
Not applicable

I'd still recommend to use OSUser() rather than section access to hide/show sheets.  To make it easier to maintain, create a variable for each sheet, e.g:

vShowSheet1 = wildmatch(OSUser(), '*user1*','*user2*', ...)

vShowSheet2 = wildmatch(OSUser(), '*user1*','*user3*', ...)

I think it is easy enough to maintain, at least no more complex than section access.

As for your approach which works on desktop but doesn't work on seerver - try to uncheck "strict exclusion".  To avoid unauthorized access, create "dummy" values.

richard_cioci
Creator
Creator
Author

‌hhowever the. I need to maintain a list of users within each sheet whereas with section access I could designate a user as a type of access and the. They auto get it. Like this I have to have a duplicate list of dozen of users for several sheets. Thanks for the suggestion though, I will use it if somerging easier to maintain on large lists of users and many sheets isn't needed.

richard_cioci
Creator
Creator
Author

Ok, so I finally got it to work, didn't take that many more steps. I thought I'd post it here for other people since some solutions can be confusing or spread over several replies. My issue was that rather than giving the Qlikview reload service the role with the highest permission, I had to give it an * to get access to all roles, even though the highest permission role should give access to all sheets (not sure why it didn't work the other way).

I'm sure there are other ways to do it, but this seemed like the easiest to manage for me.

So you start with your regular Section Access coding in the hidden script:

Section Access;

LOAD ACCESS,

     NTNAME,

     SAREP,

     NM

FROM

'..\..\..\Dashboard\SectionAccess.xlsx'

(ooxml, embedded labels, table is SA);

Then you add the sheet access coding directly underneath

Section Application;

Sheet_Security:

LOAD USERS as NM,

     SH01,

     SH02,

     SH03,

     SH04,

     SH05,

     SH06,

     SH07,

     SH08

FROM

'..\..\..\Dashboard\SectionAccess.xlsx'

(ooxml, embedded labels, table is SHEETS);

My Section Access table looks like you would expect and the NM column is to specify their role, MGR or NON for different sheet access, i.e.

NTNAME   SAREP   NM

him            Richard   NON

her             Mike       NON

mgr1           *            MGR

mgr2           *            MGR

and the Sheets Table looked like so:

USERS  SH01  SH02  SH03.... SH07 SH08

NON         1         1         1           0        0

MGR         1         1         1           1        1

Then set the condition property for each respective sheet to show if the flag for that sheet is 1, i.e.:
SH08=1

Then reload!

This allows you to simply switch roles under NM in the main Section access table, and easily switch which sheets are accessible to entire groups of users. It also prevents having to maintain a list of all necessary users in the condition formula for each sheet.

Hope this helps!