Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

QLIK SENSE: Creating a Variable without variable Interface

Hi All,

I am using Enterprise level QLIK SENSE 2.0.9 version. Where we don't have Variable interface.

How can i create a variable for expressions.

Requirement: Need a variable to store user name who ever log in to application.

Can anyone suggest how to c@reate? or do we have any extension for this?

Please respond ASAP..

Thanks in advance

Venky

marcus_sommerjamie.maguirehicjaganQlik Sense - App Development & UsageNew to Qlik Sense

5 Replies
Gysbert_Wassenaar

You can create the variable in the script using a LET or SET statement. Or you can use an extension like qsVariable.

But I think what you're looking for is the OSUser() function:

OSUser

This function returns a string containing the name of the user that is currently connected. It can be used in both the data load script and in a chart expression.

OSUser( )


talk is cheap, supply exceeds demand
Not applicable
Author

Hi gwassenaar Thanks for fast response.

if i create variable in by set or let, i hope variable will not change according to user. Will it??

Yes i need count of record according to user name NT identity.

When i use OSUSER() is Domain:YY UserId:Robert but not just Robert.

So i am using right(osuser(),len(osuser())-25. and tried in expression but i cannot get output.. can you please check below expression and correct me.

count({<[User Name]={"=(=right(osuser(),len(osuser())-25))"}>}[User ID])

Thanks

Venky

Gysbert_Wassenaar

Try count({<[User Name]={"$(=SubField(osuser(),':',-1))"}>}[User ID])


talk is cheap, supply exceeds demand
Not applicable
Author

No output.

Output of (=SubField(osuser(),':',-1) is Domain:YY UserId:Robert but not Robert.

Column [User Name] has field called Robert not Domain:YY UserId:Robert.

so KPI output is showing zero.

if i use right(osuser(),len(osuser())-25 it is showing Robert but this calculations is not working in KPI

Thanks

Venky

Gysbert_Wassenaar

I get a very different string back with '=' characters instead of ':'. Whatever, look up the SubField function if you're willing to learn how to use it. Use your right(....) expression if you don't. I don't know what data your document contains so I have no idea if there any any [User Name] values with the value "Robert". Try hardcoding that value in the set expression and see if it returns a result with the hardcoded value.


talk is cheap, supply exceeds demand