Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help with controlling access to a sheet

I have a tab which I want to only be available to a specific list of users.

I am loading the users into the dashboard via the script below.

LOAD [User Name]as CostDetails

FROM

[..\costusers.csv]

(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

I know i need to use the OSUser() function to do this, but I am not sure how

Thanks

Andy

6 Replies
vardhancse
Specialist III
Specialist III

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!

jjbom1990
Creator
Creator

If you want to do this with OSUser() you can make a variable vVisible or something

Trigger on open of document with an IF statement, If(OSUser = 'Bob',1,0) and make the sheet conditional view vVisible = 1

something like that.

what sasi said is also a viable option.

DavidFoster1
Specialist
Specialist

The Section Access approach is one option, but it does mean that all of your users need to be maintained in the lists.

A cruder approach is to;

1)     load the list of 'special users' from a spreadsheet into a isolated table (aka data island)

TabXUsers:

Load

UserName

From (Spreadsheet XYZ)

2)     Set a variable to the concatenated list of users

LET vTabXUsers = Concat(UserName,'|');

3)     Set the conditional show sheet to (syntax will need checking)  IF(Index('$(vTabXUsers)',OSUSer())>0,1,0)

rajpreeths
Creator
Creator

Hi,

Please refer the attachment.

You can open the document using the following user_ids

ADMIN  ( who can see all 3 sheets)

USER_1 ( who can see all 3 sheets)

USER_2 ( sheet2 is hidden)

USER_3 (sheet2 is hidden)

What i did is I created a REDUCTION field called REDUCTION_FLAG in the section access script and set values as 'NO' for the users who should see all sheets and 'YES' for the users who should not see particular sheet.

And then I mapped that reduction field value ( either 0 or 1) to the REDUCTION_VALUE in section application part.

And I have given the conditional hide for the sheet to be hidden for particular users as follows.

section access.PNG

Please refer the attachment for further refernce.

Hope this helps you 🙂

Regards,

Rajpreeth S

beck_bakytbek
Master
Master

Hi Andrew,

check this: QlikView Sheet Level Security Settings - YouTube

i hope this Information resolves your issue

beck

harishkumarg
Creator III
Creator III

Hi

Please follow the below steps,

Step 1:

In Edit Script give the following code,


Sheet_Access_Details:
LOAD UPPER([User Name]) as USER_NAME,
'Yes'                  
as Permission

From

FileName

;


Step 2:


Create a variable "vCurrentUser" ,


vCurrentUser =UPPER(OSUser()) 


Step 3:


Right click the sheet to which you want to give access to a specific list of users.

In the general tab you will be able to see "Conditional" option available.

Enable "Conditional" option and enter the following expression,


only({<USER_NAME={$(vCurrentUser)}>}Permission)='Yes'


I checked this in my app and its working for me.


Please try and let me know whether it works for you.


Hope this helps!


Regards,

Harish