23 Replies Latest reply: Apr 17, 2018 6:01 AM by Nikhil Garg RSS

    QS mashups and preserving selections

    Darius Pranskus



      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

        • Re: QS mashups and preserving selections
          Aiham Azmeh

          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/Overview/single-configurato…)

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



          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,



            • Re: QS mashups and preserving selections
              Darius Pranskus

              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.



              • Re: QS mashups and preserving selections
                Brijesh Maurya

                Hi Aiham


                In Our Company as well , We Created Mashup with Multiple Page . To Create a Mashup we used a Single Configurator

                IFrame Option. Am facing a Same issue that selection made on one page is not showing on another page . I tried your

                given Suggestion on that . and i tried like this Way


                <iframe src="https://qap server name/single?appid=cd2908ab-e2ab-4742-ac45-45753bcaf468&sheet=FbXVP&identity=1234&opt=currsel" frameborder="0"></iframe> ----  Page 1


                <iframe src="https://qap server name/single?appid=cd2908ab-e2ab-4742-ac45-45753bcaf468&sheet=AnsXty&identity=1234&opt=currsel" frameborder="0"></iframe> ------ Page 2


                But its not helping anything. Can you suggest me anything on this?

                  • Re: QS mashups and preserving selections
                    Aiham Azmeh

                    Hi Brijesh,


                    The real issue with multipage-mashup is actually the reloading part => so if you have a mashup (or a Sense sheet) open on in a browser on a single tab, by making selections then reloading the page, you will lose all your selections -- and the reason is obvious: the websocket (communicatinig to the app(s)) is closed and on reload newly created, so you will get a new session thathas nothing to do with the previous one. It's a WAD (Works As Designed), and practically an other software found in the wild works like that.


                    The solution/workaround:

                    A - [the recommended one] instead of a multipage-reload mashup, try to build you mashup as a "single page", without reloading your app on navigation - can be done with angular routing, location.# parsing etc...

                    B - [the hack] on[window]beforeunload create/save a bookmark with the actual selections, which can be applied on the new freshly opened page. AFAIK (I think), this is how it is done in QlikView, but I really do not recommend this approach; it's a hack, and probably not something that you want to have in production.

                    C - [the real workaround] do not open the new pages in the same tag; use target="_blank" or window.open(URL,'_blank') => this way your websocket connection will still be reusable in that browser, and the user will be able to keep his selections between pages



                    In your case I will definitively go for solution C, it will be the easiest to implement



                    - identity: It feels like the identity parameter is a little bit misunderstood - the purpose of "identity" is to keep the users using the same session in an isolated scope, not altering the shared session - passing selections from session to session will not be solved by it.

                    - keeping selections between newly created sessions: at R&D we are trying to find a solution for solving this issue, it's under investigation - and I hope that soon we will be able to provide it to you .




                • Re: QS mashups and preserving selections
                  Paul Nowicki

                  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?

                    • Re: QS mashups and preserving selections
                      Thibaut Schueller



                      I talked with people at Qlik about this, and they recommanded using a single page (one session) and destroying the model whenever you change "page" (in Angular, for example) or you hide the divs (if you do it yourself). That way, you won't get reduced performances.


                      We were using iframes and their guess was that we used to many sessions, and that Qlik Server would drop the sessions after a while.


                      Here is the code to disconnect charts before hidding them. If you have many, you could keep a collection and close the model for each chart.


                      var modelRef;


                      1. app.getObject(<elemId>, <objId>).then(function(model) {

                          modelRef = model;}


                      //then when you want to close it


                      An other possibilities is to create a bookmark before leave the first tab ( or first mashup page), apply this bookmark (it's the last bookmark) when you load the second mashup page and remove this bookmark.

                        • Re: QS mashups and preserving selections
                          Paul Nowicki

                          I plan on converting to the single page idea.  But this is a workaround.  I was hoping for Qlik to address the root cause and provide a solution to the problem.  You should be able to pass selections from one .html to another without having to perform the div hiding gymnastics of the single page concept. 


                          For example, in Qlikview you can pass selections in hyperlinks from one Qlikview report to another by modifying the url and adding the selections at the end. 

                          • Re: QS mashups and preserving selections
                            Paul Nowicki



                            I've converted to a single page mashup, but did not choose angular, just implemented the div hiding and # target setup. I am now having performance problems since I load all objects all the time.  I'm trying to implement your code example to only have the current objects open when I need them.  I have a .js code that performs actions whenever the page is changed, I can use the trigger in this code to initiate the open/close of the objects.  Is it possible to detect which objects are currently open and close all those before manually getting the new objects for the target page?  Any additional coding examples would be helpful. 

                            • Re: QS mashups and preserving selections
                              Paul Nowicki



                              I've updated my mashup and implemented the modelRef code from above.  I'm not sure if I'm actually destroying the objects as I haven't seen a  noticeable performance improvement.  Here is the code I've implemented.



                              var tabs = true;

                                var flag1 = 0;

                                var modelRef;

                                var app = qlik.openApp("xxxxxxxxxxxxxx", config);



                                if (tabs) {

                                $(document).ready(function () {


                                    $(window).on("hashchange", function() {



                                     var hash = window.location.hash;

                                     if (hash === "") {

                                           window.location.hash = $("ul.nav li:first-child").children().attr("href");


                                       $("ul.nav li").removeClass("active");

                                       $("ul.nav li").find('a[href="' + hash + '"]').parent().addClass("active");












                                 function updateQlikObjects(hash) {

                                 if (hash == "#EBBIT") {

                                flag1 = 1;

                              //EBBIT Summary Objects

                                app.getObject('QV1-1','HduqPNJ').then(function(model){modelRef = model;}); //Change Date

                                app.getObject('QV1-2','BaPBR').then(function(model){modelRef = model;}); //Report as of:

                                app.getObject('QV1-3','typMcue').then(function(model){modelRef = model;}); //KPI box - T Ebbit Global

                                app.getObject('QV1-4','FrDerNe').then(function(model){modelRef = model;}); //KPI box - T-1 EBBIT Global



                              if (hash == "#NetRev") {

                                flag1 = 1;

                                //Net Rev Objects

                                app.getObject('QV2-1','mtTkRbU').then(function(model){modelRef = model;}); //KPI box - T-1 Net Revenue Global

                                app.getObject('QV2-2','VepYmCk').then(function(model){modelRef = model;}); //KPI box - MTD Net REvenue Global

                                app.getObject('QV2-3','BayF').then(function(model){modelRef = model;}); //KPI box - YTD Net Revenue Global

                                app.getObject('QV2-4','fJcQAFu').then(function(model){modelRef = model;}); //Bar Chart - Moving Averages




                                function destroyQlikObjects(flag1) {

                                     if(flag1 == 1) {




                          • Re: QS mashups and preserving selections
                            Nandkishor Pandirkar

                            Hi Darius,


                            We are also planning for Mashup app and want to host our app to server which don't have Qlik Sense install.

                            Can you please send me some doc/ links where I can get started and code about how to get session ID for a particular user and pass it to QLik Sense server.


                            Would appreciate you help.

                            • Re: QS mashups and preserving selections
                              Soumik Sengupta



                              I have the exact same issue with the multi page mashup. I have an extension in one page which is connected to another html page. Whenever I make a selection in the extension of the 1st page, that selection does not persist when I go the extension of the second page. Any workaround except the concept of one html page would be really helpful.