Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Aspiring_Developer
Specialist
Specialist

Section access on Hierarchical data set qliksense

Hi Team ,

I have below data set :-

Employee ID Employee Name Designation Job Level Salary Data
614 Roy Senior Manager C 55
615 Tom Team Lead D 45
701 Roger Business Analyst E 12
751 Peter Business Analyst E 45
888 Adam Team Lead D 63

 

My requirement is we have a filter pane in the front end of 'Job Level'

When a user of job level C comes to see the dashboard , all the data should be visible . Now, when a user of job level D, see report , they should see their data and the data for career level E . Data for C level should not be visible , When a career level E sees, they should only see their data , no data for C, D should be visible . They should not be able to see the data for other E levels as well .

Can anyone please help ? I tried below code ,but is not working :-

Section Access;

// Security Rules
AccessTable:
LOAD * INLINE [
ACCESS, USERID, EMPLOYEE_ID, JOB_LEVEL
ADMIN, ADMIN, *, *
USER, 614, *, C
USER, 615, *, D
USER, 701, *, E
];

Section Application;

// Load your actual data
EmployeeData:
LOAD
EMPLOYEE_ID,
"Employee Name",
Designation,
JOB_LEVEL,
"Salary Data"
INLINE [
614, Roy, 'Senior Manager', C, 55
615, Tom, 'Team Lead', D, 45
701, Roger, 'Business Analyst', E, 12
751, Peter, 'Business Analyst', E, 45
888, Adam, 'Team Lead', D, 63
];

 

Can anyone please help me with this ? @tresB @sunny_talwar 

Labels (1)
2 Solutions

Accepted Solutions
GOKULAKANNAN
Creator II
Creator II

Hi @Aspiring_Developer , 

below is the example which i have taken and try to modify based on your need,

EmployeeData:
LOAD
*
INLINE [
EMPLOYEE_ID,EmployeeName,Designation,ParentId,SalaryData
1, Roy, 'Senior Manager', , 55
2, Tom, 'Team Lead', 1, 45
3, Roger, 'Business Analyst', 2, 12
4, Peter, 'Business Analyst', 5, 45
5, Adam, 'Team Lead',1, 63
];

[Ancestry Table temp]:
HierarchyBelongsTo(NodeID, AncestorID, NodeName, AncestorID, AncestorName, DepthDiff)
Load EMPLOYEE_ID as NodeID, ParentId as AncestorID, EmployeeName as NodeName Resident EmployeeData ;


[Ancestry Table]:
Load
NodeID,
NodeName,
AncestorID,
AncestorName as [Rollup Emp],
DepthDiff
Resident [Ancestry Table temp];
// drop temp table.
drop table [Ancestry Table temp];

 

Refer the page : Hierarchies in Qlik Sense - BigBear.ai

Thanks

View solution in original post

GOKULAKANNAN
Creator II
Creator II

Hi @Aspiring_Developer , 

from the above script, you will get Nodename and rollup emp, rollup emp should be NTNAME and Nodename should be renamed as NODENAME.

So while writing section access,

Section access;

Load 

'USER' as ACCESS,

NTNAME ,

NODENAME

resident TableName;

So with the above table add the admin users as well, this will create a section access with hierarchy.

View solution in original post

13 Replies
GOKULAKANNAN
Creator II
Creator II

Hi ,

Before implementing section access, you should create a hierarchy and then you have to include that hierarchy in section access, for example

ACCESS USERID JOB_LEVEL
ADMIN 614 *
USER 615 D
USER 615 E
USER 701 E
USER 888 D
USER 888 E

 

So once you create this you can further use this to implement section access, to create a hierarchy, just check hierarchy and hierarchy belongs to function in qlik.

Thanks

Aspiring_Developer
Specialist
Specialist
Author

Hello @GOKULAKANNAN 

Thanks for your response. I tried the above approach . However, I don't know how to implement in my hierarchical data set . Could you please help me ?

GOKULAKANNAN
Creator II
Creator II

Hi @Aspiring_Developer , 

below is the example which i have taken and try to modify based on your need,

EmployeeData:
LOAD
*
INLINE [
EMPLOYEE_ID,EmployeeName,Designation,ParentId,SalaryData
1, Roy, 'Senior Manager', , 55
2, Tom, 'Team Lead', 1, 45
3, Roger, 'Business Analyst', 2, 12
4, Peter, 'Business Analyst', 5, 45
5, Adam, 'Team Lead',1, 63
];

[Ancestry Table temp]:
HierarchyBelongsTo(NodeID, AncestorID, NodeName, AncestorID, AncestorName, DepthDiff)
Load EMPLOYEE_ID as NodeID, ParentId as AncestorID, EmployeeName as NodeName Resident EmployeeData ;


[Ancestry Table]:
Load
NodeID,
NodeName,
AncestorID,
AncestorName as [Rollup Emp],
DepthDiff
Resident [Ancestry Table temp];
// drop temp table.
drop table [Ancestry Table temp];

 

Refer the page : Hierarchies in Qlik Sense - BigBear.ai

Thanks

hic
Former Employee
Former Employee

Aspiring_Developer
Specialist
Specialist
Author

Hi @GOKULAKANNAN @hic 

Thanks for your response. I've gone through the links and code snippets and this is what my code looks like :-

Aspiring_Developer_0-1706628898738.png

 

Aspiring_Developer_1-1706628922142.png

 

Data Model Viewer

We are not linking the two tables as it fact table measures should not be impacted by the filters of Ancestory table 

Aspiring_Developer_2-1706628949955.png

I am very new to this hierarchical concept and not sure what to do next .Can anyone please help me on this ?

 

Thanks

GOKULAKANNAN
Creator II
Creator II

Hi @Aspiring_Developer , 

from the above script, you will get Nodename and rollup emp, rollup emp should be NTNAME and Nodename should be renamed as NODENAME.

So while writing section access,

Section access;

Load 

'USER' as ACCESS,

NTNAME ,

NODENAME

resident TableName;

So with the above table add the admin users as well, this will create a section access with hierarchy.

Aspiring_Developer
Specialist
Specialist
Author

Hi @GOKULAKANNAN 

Thank you for your response .

I tried below script and even added my ID and name in it in order to see the application myself in the section access :-

Aspiring_Developer_0-1706634591986.png

 

Aspiring_Developer_1-1706632209195.png

After reload , it is giving me below :-

Aspiring_Developer_2-1706632254543.png

 

Not sure , what I did wrong ?

 

GOKULAKANNAN
Creator II
Creator II

Hi @Aspiring_Developer ,

If you have a domain name then you have to add it, to find the domain name, inside the sheet create a KPI and add OSuser() as a measure , you will get 2 things, first one is domain , second one will be your user id, so for example , RE is domain, and GK is id, u have to mention it like "RE\GK" as NTNAME. Then only it will work, else it wont.

Aspiring_Developer
Specialist
Specialist
Author

Hi @GOKULAKANNAN 

Please see below :-

 

I think I am making some mistake here in the section access script :-

Aspiring_Developer_1-1706634677917.png

 

Aspiring_Developer_1-1706633504511.png

Am not sure about the section access script . Do I need to define the rules here , not sure 😞