Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Highlighted
zakpullen
New Contributor II

Restrict field values in chart using NTNAME & OSUSER

Hi,

I want to place restrictions within a chart, and keep the data in the rest of the app open.

The field to restrict by is 'Cost Centre'.

One loaded table (let's call is 'ACCESS') lists NTNAMEs in one column, and the Cost Centre they may access (for this purpose) in the second column.

Cost Centre is a dimension in the chart. I can't figure out how to restrict the Cost Centres displayed in the chart based on NTNAME in the ACCESS table. I'm assuming it will require matching NTNAME and the value returned by OSUSER().

 

Thank you.

4 Replies
vishsaggi
Esteemed Contributor III

Re: Restrict field values in chart using NTNAME & OSUSER

You might want to use Section Access here. And list all the users you want to restrict for Cost Centre. IF you use OSUSER() how do you know which OSUSER is restricted with what cost centre. Hence, you might need to have OSUser names from your database table or from an excel sheet to handle this. Make sure you also have the Admin user list added to your excel sheet. For example:
And make sure your connecting field name is in upper case in your model.


EMPLOYEELOGIN ACCESS COSTCENTRE
AdminUsrName1 ADMIN ''
AdminUsrName2 ADMIN ''
AdminUsrName3 ADMIN ''
username1 USER CostCenterValue
username1 USER CostCenterValue
username1 USER CostCenterValue
...... add users accordingly.

Once you do this load this excel sheet in your UI qvw file like
Section Access;
LOAD EMPLOYEELOGIN as NTNAME,
ACCESS,
COSTCENTRE
FROM
excelpath\SectionAccess.xlsx;

Section Application;

Hope this helps. If not please share some sample data to work on it.
zakpullen
New Contributor II

Re: Restrict field values in chart using NTNAME & OSUSER

Thanks, but wouldn't Section Access restrict data across the whole app?

vishsaggi
Esteemed Contributor III

Re: Restrict field values in chart using NTNAME & OSUSER

My bad I was thinking of restriction on field , you want in chart right. Still you can use this excel for that like remove section access statement and use if paused =employeelogin then costcentre something like this.
anushree1
Valued Contributor

Re: Restrict field values in chart using NTNAME & OSUSER

Yes Section Access works on the complete application and not on a specific chart