Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Everyone,
I need to assign Current User Name to Variable. How can we do that?
Actually we have Users Table. In the User Table we have User Name Category & Sub Category. We need to show application based on User accessibility
We are Loading User Table
Table:
Load *
from users.qvd
where user = $(vUser);
Here vUser should be current user.
I am assigning vUser = OSUSER(); but we are getting vUser who reloaded application. We need vUser to be who has open application.
for example: if there is users like X,Y & Z if X opens application username should show X. if Y open application username should be Y and so on.
is there any way to resolve this?
Thanks,
Satya
When the application is getting reloaded - qs doesn't know who is going to open that app, and even if it does know (you make it know) - then it is single user information for entire application - other users don't get data. In short, this approach doesn't work for user-data restriction. Qlik has Section Access for this purpose.
You have to understand that - application doesn't get reloaded every time a user accesses the app.
As @tresesco is suggesting, Section Access is most likely what you are looking for.
Hi Tresesco,
Thanks for your response on this. I agree with you we have to use Section access for it. below script we were using
QLIK_AUTHORIZATIONS:
LOAD *
INLINE [
ACCESS, USERID,USER
ADMIN,LANCO\MARK.GRAIL@XYZ.COM,LANCO\MARK.GRAIL@XYZ.COM
ADMIN,INTERNAL\SA_SCHEDULER,INTERNAL\SA_SCHEDULER
];
Concatenate(QLIK_AUTHORIZATIONS)
Load
ACCESSx as [ACCESS],
USERIDx as [USERID],
USERIDx as [USER];
SELECT DISTINCT 'USER' as "ACCESSx",
'LANCO\'||trim(upper(qlik."userid")) as "USERIDx"
FROM "public"."userinfo" ;
SECTION ACCESS;
NoConcatenate
LOAD * RESIDENT QLIK_AUTHORIZATIONS;
Section Application;
Here we were getting current login user information at field USER. we want to assign USER field value to a varaible.
can you help on this
Thanks,
Satya
I am still doubtful if I could make you understand or not. If you are saying that you are going to use the user variable in where clause - I am afraid that you are on the wrong path. But if you insists that you need to get one field value in variable , then - there would be many names/users in that field , you have to use a loop statement to get them one by one in that variable or use concat(), to get an array of names.
Hi Tresesco,
Actually we have an users table which contains fields like User, Category & Product. We also have 5 to 6 tables which contains information of Category & Product but not User. We want to link all the Tables using Category & Product as common key. So my assumption is I want to load users table based on current login user and I will link that users Category & Product with rest of the tables.
can you please look in to below issue. this is the actual requirement
Re: User Level security in application - Qlik Community - 1839863
Thanks,
Satya
Agree With @tresesco this can be only be done with Section access.
Yes, Even I agree with @tresesco
when we are using SECTION ACCESS we will get current username. we want to assign that username to a variable. by using that variable we will fetch data from user table
Hi @SatyaPaleti ,
I went through your actual post and requirement. It is classic case of simple section access implementation, and for that you don't have to get the user info into variables. What you have to do is - know more about section access - what it does and how, and then how to implement it.
Read this: https://community.qlik.com/t5/Qlik-Design-Blog/A-Primer-on-Section-Access/ba-p/1465766