Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
NickP_DF
Creator II
Creator II

Retrieve current user group

Hello Guys,

I made a section access to limit some visualizations and data access to the users in the group USER and give the full data access to the user in the group ADMIN

The section access is like this:

 

Section Access;

LOAD * INLINE [

ACCESS, USERID, PASSWORD, OMIT

ADMIN, ADMIN, 874524, ''

ADMIN, NICK, 512476, ''

ADMIN, JOHN, 541368, ''

USER, GEORGE, 877542, ''

USER, MICHAEL, 478142, ''];

I'd like to make the configuration by using the groups (ADMIN and USER) instead of user-by-user with the function qvUser(), but I'm not able to find the function to get the group.

Could someone help me, please?

Thank you so much.

Nick.

2 Solutions

Accepted Solutions
PiEye
Contributor III
Contributor III

Hi Nick

Section access can actually be linked to the main data, this is actually one of the cool features  and extremely powerful! It means you can set which subset of data that the users can see.

In this instance, we can use it to link the user to a stand alone table with the groups, and use this standalone table to retrieve the group

In the load, instead of loading directly into section access we can use a temporary table to create both the standalone table and the main section access table. In both, I have added a key field which links the two.

tmp_SA:
LOAD *,
Rowno() AS SA_LINK;
LOAD * INLINE [
ACCESS, USERID, PASSWORD, OMIT
ADMIN, ADMIN, 874524, ''
ADMIN, NICK, 512476, ''
.
.
.];

SA_Dim:
LOAD Distinct
SA_LINK,
ACCESS
RESIDENT tmp_SA;


SECTION ACCESS;

NoConcatenate LOAD * RESIDENT tmp_SA;

SECTION APPLICATION;


DROP TABLE tmp_SA;

 

What you will then need to do in the document properties is check the section access reduction option and this will reduce our stand alone table to the single row for each user when they log into the application

PiEye_0-1625564885577.png

 

Does this work for you?

View solution in original post

PiEye
Contributor III
Contributor III

Unfortunately there isn't, it would likely be listed here if it was https://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/Scripting/SystemFunctions/system...

 

A simpler alternative might be to create a replica of the section access table in the front end. 

You could then put osuser() into a variable and use that value to get the related group:

Replica table in front end:

PiEye_0-1625566021721.png

 

Function returning the group:

=only({<USERID={"$(vUser)"}>} ACCESS)

This is where I have set vUser =OSUser() in the variables dialogue

 

View solution in original post

5 Replies
PiEye
Contributor III
Contributor III

Hi Nick

Section access can actually be linked to the main data, this is actually one of the cool features  and extremely powerful! It means you can set which subset of data that the users can see.

In this instance, we can use it to link the user to a stand alone table with the groups, and use this standalone table to retrieve the group

In the load, instead of loading directly into section access we can use a temporary table to create both the standalone table and the main section access table. In both, I have added a key field which links the two.

tmp_SA:
LOAD *,
Rowno() AS SA_LINK;
LOAD * INLINE [
ACCESS, USERID, PASSWORD, OMIT
ADMIN, ADMIN, 874524, ''
ADMIN, NICK, 512476, ''
.
.
.];

SA_Dim:
LOAD Distinct
SA_LINK,
ACCESS
RESIDENT tmp_SA;


SECTION ACCESS;

NoConcatenate LOAD * RESIDENT tmp_SA;

SECTION APPLICATION;


DROP TABLE tmp_SA;

 

What you will then need to do in the document properties is check the section access reduction option and this will reduce our stand alone table to the single row for each user when they log into the application

PiEye_0-1625564885577.png

 

Does this work for you?

NickP_DF
Creator II
Creator II
Author

Hello PiEye,

first of all, thank you for the reply; I assume that your suggestion will surely work, but it's a bit sophisticated...I'll keep it as a B-plane if there isn't a simpler way to get what I need (it seems very strange to me that there isn't a simple function like qvUser() to get the group instead of the user): am I a dreamer? 😉

Bye.

N.

PiEye
Contributor III
Contributor III

Unfortunately there isn't, it would likely be listed here if it was https://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/Scripting/SystemFunctions/system...

 

A simpler alternative might be to create a replica of the section access table in the front end. 

You could then put osuser() into a variable and use that value to get the related group:

Replica table in front end:

PiEye_0-1625566021721.png

 

Function returning the group:

=only({<USERID={"$(vUser)"}>} ACCESS)

This is where I have set vUser =OSUser() in the variables dialogue

 

NickP_DF
Creator II
Creator II
Author

Hi Pi,

thank you for this solution; it's simpler than the previous one, and I'll proceed with it.

See you soon.

N.

PiEye
Contributor III
Contributor III

Great 🙂