Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, I'm new to the QlikSense API, and I'm confused about how to use the selections API: selectionState method ‒ Qlik Sense Developers
Basically, I have built a mashup site where I included the Selections Bar at the top, so my users can apply selections to the objects on the page.
What I need is to SAVE the current selection state somewhere, so I can then later re-apply it at will.
However, this is giving me trouble. I know I can obtain the current selection state by calling:
var currentSel = app.selectionState();
however, this object cannot be serialized to string (due to circular dependencies) and even if I could serialize it, I can't find a method to APPLY it to the app later on.
How can I achieve this?
Maybe look at saving the selection state to a Bookmark and when you need to apply the bookmark.
I have never tried doing this so don't know the API calls off hand, but in theory I reckon it should work.
Hi,
You could use app.bookmark.create:
create method ‒ Qlik Sense Developers
What you would do is create a bookmark and save the id you get back (that is you get a promise back, when the promise resolves, you'll get the id. Save the id, and apply it later with app.bookmark.apply: apply method ‒ Qlik Sense Developers
You could use the selection state, in that case you would need to loop over all fields with selections, and save the selected values for all fields. When you recall the selection you would do it the other way around. This would be complicated in case there are many selections, using a bookmark is much easier.
Hope this helps
Erik Wetterberg