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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to connect NT ID with table in Script

Hi All

I have one table which has field 'USER_ID' and other fields, so particular user can see associated data.

How do I join NT_ID(Window Log in) to USER_ID(Table) without section access. So user can access only their data

Your reply is highly appreciated...Thanks

8 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

Check out function OSUser(). No parameters. Returns the Windows account of the current document user (both in Desktop and in AP client) in the format

domainname\accountname

Best,

Peter

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Sorry, OSUser() will only serve you in the UI, which is not exactly what you are asking. However, the user ID of a visitor is only known when the document is opened, not at reload time.

The script can provide restrictions to be applied later on at the time a document is opened only via Section Access and data reduction.

IMHO the only other technique that does not make use of section access or data reduction consists of using OSUSer() in set analysis to reduce displayed data in every object to what the current user is allowed to see by your special table.

Peter

Anonymous
Not applicable
Author

Hi Peter

Thanks for prompt reply.

How do I load OSUser() in order to connect with USER_ID from one of the table in scrpting

Thanks

Peter_Cammaert
Partner - Champion III
Partner - Champion III

You do not.

OSUser() is a function that returns the ID of the user that has your document open. In the load script, you would get the ID of the account that is reloading the document (probably a service account).

If you do not want to use Section Access or any of the related features, then you keep your document as is. Imagine that you have a chart with a single expression, say Sales.The expression for your chart now becomes:

=Sum({<USER_ID = {"$(=OSUser())"}>} Sales)

which will restrict aggregation to only those amounts that are associated to the current user.

But I think that you should evaluate Section Access as a solution. It works very well.

Peter

Gabriel
Partner - Specialist III
Partner - Specialist III

Anonymous
Not applicable
Author

Hi Gabriel

Excellent suggestion and appreciable.

But I already have developed the report and finding way to restrict data at script level Or Sheet level?, if possible.

Thanks for your valuable effort

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Then there is only one solution: Section Access with Data Reduction. What makes this solution unique is that it loads all data into your document, and prepares a mechanism that is triggered whenever a user opens your document. Only then will the data be reduced, without further load on your associative model. You won't need to change your User Interface, except if you want to make objects and/or sheets show up depending on the user that opens the document.

Peter

Anonymous
Not applicable
Author

Hi Peter

Your suggestion is nice and helpful to me.

Thanks for your valuable time