Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
So hopefully a quick, two part question - it appears qvuser() doesn't return any data on Qlik SaaS , and osUser() only returns the user that reloaded the app.
I was hoping to be able to retrieve the currently logged in user viewing the app - in order to allow that user to automatically filter their data with a button action.
So - is there a plan to make a 'live' user function, so when referenced, it's aware of who is logged in ( similar to section access ) - or is there another function I'm not aware of to attain this info?
@110 OSUser() will return the currently connected user. See the documentation below from Qlik Help.
https://help.qlik.com/en-US/sense/May2024/Subsystems/Hub/Content/Sense_Hub/Scripting/SystemFunctions...
You can use the expression below, which will evaluate and extract the user, then apply your filter condition:
=SubField(OSUser(), '=', -1)
As informed @eike_s by the configuration, it can return either the IDP or the email.
- Matheus
In the Qlik Cloud, the OSUSER() function outputs the ‘Idp subject’ of the current user under userid. Depending on how and what kind of IdP is configured, the corresponding value is returned.
@110 OSUser() will return the currently connected user. See the documentation below from Qlik Help.
https://help.qlik.com/en-US/sense/May2024/Subsystems/Hub/Content/Sense_Hub/Scripting/SystemFunctions...
You can use the expression below, which will evaluate and extract the user, then apply your filter condition:
=SubField(OSUser(), '=', -1)
As informed @eike_s by the configuration, it can return either the IDP or the email.
- Matheus
Thanks @MatheusC & @eike_s -
I was trying to be smart by encapsulating the logic into a variable to make it easier to use.- what was odd, was under some visualizations referencing via the variable - presume had the original calculated value of the variable from the load and not the 'live' one.
AS @MatheusC suggested, doing the subfield 'live' - without using variables works and works in some tests with other users.
='You are logged in as : ' & vEmailLoggedInUser & ' Associated Site :' & only(if(KeyEmailMatchUpper = trim(upper(SubField(osuser(),'UserId=',2))),OfficeName))