Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
ivandrago
Creator II
Creator II

Section Access - Help

Hi,

I want to use the Section Access but do not know where to start, I have the attached
document, on here there is a field called AreaId, I want this to be limited based on what the
user has access to, for example

UserID AreaID
BobA 1235
BobA 1237
DavR 1236
DavR 1235
SimS See All

So UserID SimS can see all ther data on the document, how would I be able to do this?

Thanks

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hi,

In order to get one user able to see all the records, you need first all possible values for your reduction field (AREAID) listed in the section access:

CONCATENATE LOAD * INLINE [ ACCESS, NTNAME, AREAID USER, DOMAIN\USER1, AAA USER, DOMAIN\USER2, BBB USER, DOMAIN\USER2, CCC USER, DOMAIN\USER3, * ];


In this case, User3 will be able to see all listed values (AAA, BBB, CCC). However, if the field AREAID has more values not listed in the section access, these will be reduced from the document, so the user will not see them. Say you add a new record with ZZZ as AREAID, and that you want USER3 to read it. You will have to add a new record to the table above (before the "*" line)

USER, DOMAIN\USER3, ZZZ


So again, any possible value that you want to be visible must be listed in the reduction field.

Hope that helps.

View solution in original post

23 Replies
deepakk
Partner - Specialist III
Partner - Specialist III

hi ,

Below is the code for Section Access.

Section Access;

LOAD * INLINE [

ACCESS, USERID, PASSWORD ,AREAID

ADMIN ,abc,abc,111

];

Section Application;

the AREAID need to be link with you data AREAID.

In section ACCESS the fieldname should be in CAPITAL letters.

I hope this helps.

ivandrago
Creator II
Creator II
Author

Hi Deepak,

I have added the following to the script?

Section Access;

LOAD * INLINE [

ACCESS, USERID, AREAID

ADMIN ,BobA, 1235

];

Section Application;

Load * INLINE [
AreaId
1235
];

Is this right? Also do I have to amend anything on the Document Properties?

Miguel_Angel_Baeyens

Hello,

The piece of script related to section access should look like

STAR IS *; SECTION ACCESS; // All fieldnames must be UPPPERCASELOAD * INLINE [ACCESS, USERID, PASSWORD, AREAIDUSER, BOBA, BOBA, 1235USER, BOBA, BOBA, 1237USER, DAVR, BOBA, 1236USER, DAVR, DAVR, 1235USER, SIMS, SIMS, *ADMIN, ADMIN, ADMIN, *]; SECTION APPLICATION; // Your script here


Provided you already have an "AREAID" (uppercase, if not, just rename your field AreaID to AREAID) in your data model, go to Settings menu, Document Properties, Opening, and checking "Initial Reduction..." and "Strict exclusion" (so any user not logged in or without data associated to its user won't be able to log in).

Users will be prompted for user and password, and those must match the ones set in the section access (all user and password in uppercase)

Hope that helps.

deepakk
Partner - Specialist III
Partner - Specialist III

OPs I forgot,

yes you need to go to Document Properties-- Opening tab--Select intial Data reduction and untrict strict exclusion

and in your script the Areid in the scond table needs to be in Capital same as in Section Access

ivandrago
Creator II
Creator II
Author

Hi Miguel,

What do I need to put in the SECTION APPLCATION? I have made AREAID as upper case now. Also I don't want it to ask the user for a password when they click on the Document from Access Point, as they will only see the document if I have authorized them as a user, I just want it so when it opens the Document it is limited based on the AREAID they have access to.

Thanks

ivandrago
Creator II
Creator II
Author

Hi

I have created a qvd first which will hold all the users, below is script:

ACtrl:
SQL SELECT
'USER' as ACCESS,
UPPER(LTRIM(RTRIM(NETWORKID))) as USERID,
AreaId as AREAID
From TableA;

CONCATENATE
LOAD * INLINE [
ACCESS, USERID, AREAID
USER, SIMS, 1237];

STORE ACtrl INTO C:\ACtrl.qvd (QVD);

I have then gone into my Document and added the following:

STAR IS *;

SECTION ACCESS;
Security:
LOAD [ACCESS],
USERID,
AREAID
FROM

(qvd);


SECTION APPLICATION;
LOAD
AREAID
FROM
(qvd);

I have rloaded the Document but it comes up with "Execution of Script failed. Reload old Data?", I have not ticked the following yet "go to Settings menu, Document Properties, Opening, and checking "Initial Reduction..." and "Strict exclusion" as I do not want to be locked out as of yet?

Miguel_Angel_Baeyens

Hello,

You do need to set the SECTION APPLICATION because it's the way you tell QlikView you are going to start loading data that doesn't belong to the section access.

If you don't want to ask for password, use NTNAME in section access instead of USERID and PASSWORD, and set it to the result of the function OSUser() in the client's computer, so the data will be reduced, although the user won't be prompted for password. Your section access table will look like then

LOAD * INLINE [ACCESS, NTNAME, AREAIDADMIN, DOMAIN\ADMINACCOUNT, *USER, DOMAIN\USER1, 253USER, DOMAIN\USER1, 254];


To your other post above, when you load section access from QVD files, you need to perform the load unoptimized, so you need to add something (the following works) to your LOAD statement

LOAD USERID, PASSWORD, ACCESSFROM File.qvd (qvd) WHERE 1=1; // This line prevents the optimized load


Hope that helps.

ivandrago
Creator II
Creator II
Author

Thanks Miguel, so can you see why the below script would fail then?


SECTION ACCESS;
Security:
LOAD [ACCESS],
NTNAME,
AREADID
FROM

(qvd);


SECTION APPLICATION;

STAR IS *;

Reduction:
LOAD NTNAME,
AREAID
FROM
(qvd);

Miguel_Angel_Baeyens

At a first glance, you haven't applied the changes I mentioned above:


IvanDrago wrote:STAR IS *;
SECTION ACCESS;
Security:
LOAD [ACCESS],
NTNAME,
AREAID
FROM (qvd) WHERE 1=1;

SECTION APPLICATION;

//Reduction: // There's no need for this one, commented
//LOAD NTNAME,
// AREAID
//FROM (qvd);


Hope that helps.