Create dynamic, user specific, bookmarks
This example supports creating user specific dynamic bookmarks. This is great where you may have a use case where a user can see all of the data (ie no section access) but for usability reasons, users should have a default element assigned relevant to their organisational structure.
Aside from the script there are the following pre-requisites (annotated in the script where applicable):
An existing connection to the Qlik Sense repository
Create a custom property in Qlik Sense and assign to users (in example below this is called OrgUnit)
Ensure there is a field in the primary data set that matches this property (eg we are using Org Unit in this sample)
Create variables called vUser and vOrgUnit (sample definitions in the script below)
Clear all filters and then apply an expression based filter against the [Org Unit] field as per the sample below
Create a bookmark and make it the Default for when the app is opened
/* Retrieve custom attibutes against user Can be used to create a default bookmark with the following example Step 4 Variables: vUser: =SubField ( OSUser(), '=', 3 ) vOrgUnit: =MaxString ( {$<[User name] = {"$(vUser)"}>} [Org Unit] ) Step 6: Create a dynamic bookmark using the following example and make it the default <[Org Unit]={"=Only([Org Unit])='$(vOrgUnit)'"}>} Example assumes user has custom attribute called Org Unit and value is set and app has data for linked Org Unit */ // This is related to step 1 LIB CONNECT TO 'Qlik Sense Repository'; // This brings back the custom proeprties for step 2 [User Default Org Unit]: Load ID As [PropertyId], Name As [Property] ; Select "ID", "Name" FROM "public"."CustomPropertyDefinitions" WHERE "Name" = 'Org Unit'; Left Join ( [User Default Org Unit] ) Load Value As [Org Unit], Definition_ID As [PropertyId], User_ID As [UserId] Where Exists ( PropertyId, Definition_ID ); SELECT "Value", "Definition_ID", "User_ID" FROM "public"."CustomPropertyValues"; Left Join ( [User Default Org Unit] ) Load ID As UserId, UserId As [User], UserDirectory, Name As [User name] Where Exists ( UserId, ID ); SELECT "ID", "UserId", "UserDirectory", "Name" FROM "public"."Users"; // Step 3 - you other data can be loaded here or before this block.