Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Become an analytics expert with Qlik's new 15 week course: Applied Data Analytics using Qlik Sense. READ MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
morenoju
Partner
Partner

Qlik Sense: Different datasource depending on the user

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

1 Solution

Accepted Solutions
petter
MVP
MVP

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 ..........;

https://help.qlik.com/en-US/sense/September2018/Subsystems/Hub/Content/Sense_Hub/Scripting/Security/...

For the fieldnames in section access all of them have to be in uppercase and you should also keep field values in uppercase.

View solution in original post

3 Replies
Ivan_Bozov
Luminary
Luminary

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.

morenoju
Partner
Partner
Author

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.

petter
MVP
MVP

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 ..........;

https://help.qlik.com/en-US/sense/September2018/Subsystems/Hub/Content/Sense_Hub/Scripting/Security/...

For the fieldnames in section access all of them have to be in uppercase and you should also keep field values in uppercase.

View solution in original post