Qlik Community

Qlik Sense Integration, Extensions, & APIs

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

d_pranskus
Contributor III

QS mashups and preserving selections

Hi

I have several html pages where I use QS objects from single document. What I want is to preserve/transfer selections which I make on one page to another page. What is the best/correct way to do it? Is it some setting or I need to invoke API. Any samples would be much helpful. Thanks

Tags (2)
1 Solution

Accepted Solutions
Employee
Employee

Re: QS mashups and preserving selections

So you have different pages with different objects, and want to drive selections from ex: page 1 to all other objects inclusively page 2 etc ?

- add selection bar to page 1 :

app.getObject( 'your_element_id', 'CurrentSelections' );

- add all objects on all pages width workbench

- modify all your different pages config object to use the same identity:

var config = {

  host: window.location.hostname,

  prefix: "/",

  port: window.location.port,

  isSecure: window.location.protocol === "https:",

identity : "[U_ID]"

};

so now any changes in page1.html will also affect page2.html.

I hope I got it right this time,

aiham

23 Replies
Employee
Employee

Re: QS mashups and preserving selections

Hi Darius,

If I understood you well, you want to from a Single Object page be able to influence selections in another Single Object selection page!?

You can do that with the identity parameter (http://help.qlik.com/sense/en-us/developer/#../Subsystems/Workbench/Content/BuildingWebsites/Overvie...)

by passing the same identity to all your Single Object pages.

example:

let's say you have 2 iframes on different pages

<iframe src="http://[YOUR_SERVER]/single?appid=[YOUR_APP_ID]&obj=[OBJECT_1]&identity=[U_ID]" frameborder="0"></iframe>

<iframe src="http://[YOUR_SERVER]/single?appid=[YOUR_APP_ID]&obj=[OBJECT_2]&identity=[U_ID]" frameborder="0"></iframe>

by adding the identity=[some_id] parameter to both, you will be able to reflect selections from the first object to the second one.

I hope It will help,

aiham

d_pranskus
Contributor III

Re: QS mashups and preserving selections

Thanks Aiham

It is really helpful. What I want is to embed any number of objects on the html, which includes charts and lists and have one selection box. I was doing it through workbench by placing some divs with ids on  thye page and then replacing them by actual QS ojects in the Javascript code.

It seems that embedding single objects with URL is much simpler but I need to figure out how to have single current selection box on a page for several embedded objects. I know that I can add current selection boxes to all of them. But how to have single one.

Cheers

Employee
Employee

Re: QS mashups and preserving selections

So you have different pages with different objects, and want to drive selections from ex: page 1 to all other objects inclusively page 2 etc ?

- add selection bar to page 1 :

app.getObject( 'your_element_id', 'CurrentSelections' );

- add all objects on all pages width workbench

- modify all your different pages config object to use the same identity:

var config = {

  host: window.location.hostname,

  prefix: "/",

  port: window.location.port,

  isSecure: window.location.protocol === "https:",

identity : "[U_ID]"

};

so now any changes in page1.html will also affect page2.html.

I hope I got it right this time,

aiham

d_pranskus
Contributor III

Re: QS mashups and preserving selections

Thanks

Is it possible to do that by embedding current selections as iframe & URL and not by javascript?

Employee
Employee

Re: QS mashups and preserving selections

With no object, not really; but...

I do not recommend that : - you can always create an "empty" extension and after saving it to your app, in single object add current selection with &opt=currsel (and identity parameter) then use it in an iframe.

Why I do not recommend it:

- The use of many iframes will be limited in certain browsers since Qlik Sense uses web-sockets, so for example for Internet Explorer users you will have a limit of maximum 6 connections == 6 iframes.

- It will have a huge impact in your page loading performance.

aiham

d_pranskus
Contributor III

Re: QS mashups and preserving selections

Thanks

d_pranskus
Contributor III

Re: QS mashups and preserving selections

Hi

It must be the correct answer, I included the identity parameter in the js code, but when I select something on a page it appears in Current Selections page, but if I reload page, it is gone.

Do I need to use that parameter identity somewhere or just in config?

What could be a problem?

Employee
Employee

Re: QS mashups and preserving selections

Hi Darius,

I don't think it's possible to have persistent selections without having a bookmark.

You may find more insights in this thread : Current selections lost when loading new page

aiham

pnowicki
Contributor

Re: QS mashups and preserving selections

After reading several posts on this topic, is it the conclusion that it is not possible to preserve the selections when moving between different html pages in a mashup?  If so, that is really disappointing. 

@Qlik - is there anyway to improve this as the mashup idea is really being embraced by users?