Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

OSUser vs QVUser

I wanted to know how OSUser and QVUser works

For e.g If I have A.qvw file in which I am using OSUser (Let osUser = OSUser()) and QVUser (Let qvUser = qvUser()) in script

Without reloading what will be the value when different users access A1.qvw file?

Means I (as User1) reloaded the file and deployed it.

When User1 and User2 access the A1.qvw file what will be the value of variable osUser and qvUser in script.

11 Replies
swuehl
MVP
MVP

LET will evaluate the expression (OSUser() resp. QVUser() ) once during script execution and assign the result to the variable (i.e. a string containing the user). No update of the variable value until you re-load.

Let ‒ QlikView

Maybe you want to create a variable that will update dynamically in the frontend like

LET User = '=OSUser()';

LET User = '=QVUser()';

maxgro
MVP
MVP

I think the variable osUser is stored with the A.qvw file and it doesn't change until you reload the .qvw.

So User1 and User2 will will get the same value of the variable.

If you use OSUser() function in a chart, User1 and User2 will get different values.

andrei_delta
Partner - Creator III
Partner - Creator III

Hello,

For your first question : OSUser will show the current user you are using on your operating system; QVUser brings you the last User from section access who used the application.

for the second statement the variables will be yours for both yours.

for the third state: QVUser will return last user that entered the app and OSUser will be different, depending on their system.

Anonymous
Not applicable
Author

Thanks for reply.

How can I use below in where clause of resident load table.

LET User = '=OSuser()";

If my table has following data

User,Region

User1,US

User2,UK

User1, Spain

User3,France

I want below output if User1 uses .qvw file

User,Region

User1, US

User2,-

User1, Spain

User3,-

I have tried but filter is not applied

swuehl
MVP
MVP

That's Section Access was designed for:

Introduction to Section Access

Anonymous
Not applicable
Author

Thanks for reply.

I donot want data reduction.

I want to mask the data(columns) which is not applicable to logged in user.

As there are many objects,I donot want to this at object level.Instead.

I have tried the various approaches,but the approach of ='=OSUser()', fits my requirement. But now only concern is how to use it where condition.

swuehl
MVP
MVP

Sorry, I don't get what you want.

Your previous example with the Region field indicates that you do want data reduction (i.e. a filter of field values depending on user accessing the QVW). Now you are talking about showing different fields / columns depending on the user (which you can accomplish using section access in combination with the OMIT field in section access table).

If you want to use a WHERE clause in the script, then this would require to reload the data when a new user accesses the QVW, I don't think that's what you want.

Anonymous
Not applicable
Author

I want to show all the records from table but mask the critical data (sale price for the country which users does not belong) for other users.

I cannot do this at object level as there are many object on the dashboard. Also, user can create there own graph/pivots.

I want to handle this at script level hence require userid so that I apply filter on Resident Load table.

swuehl
MVP
MVP

And why can't you use section access for this requirement?

If you don't want to use section access, what is your exact issue with using a WHERE clause?