Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am trying to create a default filter selection based on user login and seems like it doesnt work.
this is what i have done till now:
LET vUserRaw = OSUser();
LET vUser = Upper(Trim(SubField(SubField('$(vUserRaw)',';',2),'=',2)));
LET vDefaultSelection =
IF(vUser='xxyy','Sweden',
IF(vUser='bbbb','Norway',''));
and used this '$(vDefaultSelection)' in SimpleFieldSelect object under Selections > Select this one as Default.
However when I reload this app, it works for the UserID who reloaded the app and takes that as the default filter selection and doesnt dynamically change when an other user logs in.
- its not ideal for all users to reload the app
- this is not to restrict the data, but just to give default filter selections to users based on their area.
- I tried the actions also on the sheet properties but that doesnt work.
Anyother way to do this ? so the filterselection changes dymanic
I had the same idea months ago.
I did like:
Let vCurrentUserEmail = GetUserAttr('userEmail');
Let vCurrentUserID = GetUserAttr('userSubject');
You will want to do this dynamically using an expression for the value selection:
=Pick(
WildMatch(OsUser(),
'*=xxyy'
, '*=bbbb'),
'Sweden'
,'Norway)
This works for a small amount of users. For a larger user list, load up a table of userids and Country and use something like this for your selection expression:
=Only({<user={"=Lower(SubField(OsUser(), '=', 2))"}>} Country)
-Rob
To set a default filter based on user login in Qlik Sense, use Section Access to link user IDs to specific data, or create a default bookmark based on OSUser(). For dynamic, non-security filtering, use an action button on sheet initialization to select values using expressions like IF(OSUser()='A','Selection1','Selection2').
Key Approaches for Default User Filters
Common Issues and Tips