Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

pamaxeed
Contributor III

Extension - Save App State (simulate Bookmark functionality)

Hi all,

we are developing an extension and we came to the point where we would like to save the app state with all the current selections, which afterwards we would like to restore through a Link/Button hit.

I am wondering how the Bookmark functionality is working behind the scene?

Can someone point out this behaviour :-) ?

Thanks and regards,

Patric

1 Solution

Accepted Solutions
erik_wetterberg
Honored Contributor

Re: Extension - Save App State (simulate Bookmark functionality)

Hi Patric,

The easiest way is to use app.bookmark.create in the javascript API. That will create a bookmark for you, much like a bookmark created by the user in the client.

You can look for an example on this in the Toolbar extension, that comes with the installation.

Another option is to use the engine api. That gives you more control over the bookmark, like you can set the ID and the type yourself (I haven't tried, but I think setting your own type would hide it in the client, which you might want).

Hope this helps

Erik Wetterberg

Qlik Sense consultant

Erik Wetterberg
https://extendingqlik.upper88.com/
8 Replies
erik_wetterberg
Honored Contributor

Re: Extension - Save App State (simulate Bookmark functionality)

Hi Patric,

The easiest way is to use app.bookmark.create in the javascript API. That will create a bookmark for you, much like a bookmark created by the user in the client.

You can look for an example on this in the Toolbar extension, that comes with the installation.

Another option is to use the engine api. That gives you more control over the bookmark, like you can set the ID and the type yourself (I haven't tried, but I think setting your own type would hide it in the client, which you might want).

Hope this helps

Erik Wetterberg

Qlik Sense consultant

Erik Wetterberg
https://extendingqlik.upper88.com/
pamaxeed
Contributor III

Re: Extension - Save App State (simulate Bookmark functionality)

Hi Erik,

thanks for the info.

Yes one requirement is that those bookmarks should be not visible for the end user in fact.

Do you know if there is a limit in creating bookmarks? I mean in the number...? Some impact on the performance?

Thanks!

Patric

akl
Honored Contributor

Re: Extension - Save App State (simulate Bookmark functionality)

There is not a limit per se for bookmarks. However since a bookmark contains all the selected field values it could potentially contain a very large number of values that could grow the application size that has to be loaded into ram. Now it seems like you would have some control of the selection behavior so that might not be a problem but historically in QlikView we could see some performance impacts when a user saved a bookmark for 20+ million values selected for example.

pamaxeed
Contributor III

Re: Extension - Save App State (simulate Bookmark functionality)

Thank you guys for the helpful insight regarding this topic!

We will be aware of this behaviours regarding size and performance when it comes to a high number of selected values.

erik_wetterberg
Honored Contributor

Re: Extension - Save App State (simulate Bookmark functionality)

There is actually a feature in Qlik Sense that uses this: the snapshot feature is built on bookmarks. If you want to go this way, you could use enigma (included with the client) to communicate with the engine.

Erik Wetterberg

Qlik Sense consultant

Erik Wetterberg
https://extendingqlik.upper88.com/
Highlighted
pamaxeed
Contributor III

Re: Extension - Save App State (simulate Bookmark functionality)

Hi guys,

finally I had some time to test the bookmark functionality using the enigma.js framework, when it comes to save the app state. I could successfully implement the feature for the Qliksense Desktop Environment  (3.2), but on the other hand I have some problems to make it work on the Qliksense Server (3.2) and I do not know on what it relies.

It would be nice if you could have a look on the extension prototype on github:

https://github.com/pamaxeed/qs-enigma-bookmark/blob/master/src/visualization.js

The ApplyBookmark call returns false on the Server environment:

enigma.getService('qix', cfg).then((qix) => {

     qix.app.applyBookmark(qId).then((layout) => {

          console.log(layout);

     });

});

It seems that the bookmark gets not persisted on the Server environment, the bookmark seems to be created but when calling applybookmark passing the ID it returns false:

errorbookmark.PNG

Some ideas?

Regards,

Patric

erik_wetterberg
Honored Contributor

Re: Extension - Save App State (simulate Bookmark functionality)

Hi,

Using the filename for appid probably does not work in a server environment. In and extension you should not have to open a new socket, try to use the one that is already open. There is a referenser to it called enigmaModel.

Hope this helps

Erik Wetterberg

Erik Wetterberg
https://extendingqlik.upper88.com/
pamaxeed
Contributor III

Re: Extension - Save App State (simulate Bookmark functionality)

Works like a charm!

Thanks!

Community Browser