If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.
Hello all,
Is it possible to display data from a different datasource depending on the user logged in?
I'm thinking of an app with several sheets and the data displayed in them being from one Vertica server or another depending on the user that has logged into the system.
Do you have any experience doing something like that?
Thanks,
Juan
That can easily be achieved by using SECTION ACCESS. You will get data from each source into the same tables and/or different tables but you make sure you have an extra fields in each table that can be named SOURCE if you like. Then you put an appropriate source name or id into the field and the rows that are coming in from a particular source.
The SOURCE field can be used in the SECTION ACCESS tables and associated with the different users and or groups to let them only have access to the rows coming from the appropriate source.
SECTION ACCESS; /*******************************************************/
LOAD * INLINE [
ACCESS, USERID, GROUP, SOURCE, OMIT
USER, *, ADMIN, *,
USER, *, A, DB1,
USER, *, B, DB2, NUM
USER, *, C, DB3, ALPHA
USER, ABC\OLIVER, *, DB4,
USER, *, D, DB1,
USER, *, D, DB2,
ADMIN, INTERNAL\SA_SCHEDULER, *, *,
];
SECTION APPLICATION; /*************************************************/
LIB CONNECT TO DB1;
T1:
LOAD
'DB1' AS SOURCE,
*;
SQL
SELECT ..........;
LIB CONNECT TO DB2;
T1:
LOAD
'DB2' AS SOURCE,
*;
SQL
SELECT ..........;
For the fieldnames in section access all of them have to be in uppercase and you should also keep field values in uppercase.
I guess you would have to load both data sources, create one sheet using the first, the other sheet using the second source and give rights to users with section access.
Thanks Ivan. But that would mean having to mantain two sheets.
What I’m trying to achieve is having a single app where each of the sheets use the data from a datasource depending on the user logged into, but without having to duplicate sheets.
That can easily be achieved by using SECTION ACCESS. You will get data from each source into the same tables and/or different tables but you make sure you have an extra fields in each table that can be named SOURCE if you like. Then you put an appropriate source name or id into the field and the rows that are coming in from a particular source.
The SOURCE field can be used in the SECTION ACCESS tables and associated with the different users and or groups to let them only have access to the rows coming from the appropriate source.
SECTION ACCESS; /*******************************************************/
LOAD * INLINE [
ACCESS, USERID, GROUP, SOURCE, OMIT
USER, *, ADMIN, *,
USER, *, A, DB1,
USER, *, B, DB2, NUM
USER, *, C, DB3, ALPHA
USER, ABC\OLIVER, *, DB4,
USER, *, D, DB1,
USER, *, D, DB2,
ADMIN, INTERNAL\SA_SCHEDULER, *, *,
];
SECTION APPLICATION; /*************************************************/
LIB CONNECT TO DB1;
T1:
LOAD
'DB1' AS SOURCE,
*;
SQL
SELECT ..........;
LIB CONNECT TO DB2;
T1:
LOAD
'DB2' AS SOURCE,
*;
SQL
SELECT ..........;
For the fieldnames in section access all of them have to be in uppercase and you should also keep field values in uppercase.