2 Replies Latest reply: Jan 15, 2017 9:24 AM by Yakir Manor RSS

    Open Expression URL Link in same browser window

    Roz Meehan

      Hi

      I have a document that contains a summary sheet and a detail sheet. I'm trying to emulate "drill-through" functionality from the expression values in the summary sheet to the corresponding breakdown on the detail sheet, by linking the document to itself and passing in some selections.

       

      In the summary table I've defined the expression as a link with a URL to itself; as part of the URL definition I've set it to open the Detail sheet, apply the relevant selections so as to display the detailed breakdown.

      All of this is working fine, bar one thing - I can't get the URL to launch within the same browser window - it always opens up the detail sheet in a new browser.

       

      Anyone any ideas on how to make the URL open within the same window?

       

      This is the syntax of my URL

      http://server/QvAJAXZfc/opendoc.htm?document=doc.qvw&host=local&sheet=SHDetail&select=LBVCB,'&[Currency] & '&select=LBCRID,'& [Date]

       

      thanks

      Roz

        • Re: Open Expression URL Link in same browser window
          Irshad Mody

          Did you get an answer to this?  Stuck with the same issue.

          • Re: Open Expression URL Link in same browser window
            Yakir Manor

            this issue has 2 simple solutions (this solution also supports sub domain):

            1. intervene in the opendoc.htm

            the file location is:

            C:\Program Files\QlikView\Server\QlikViewClients\QlikViewAjax

             

            you can put a listener on the dom

            $(document).bind('DOMSubtreeModified', function () {
              $("a[target='_blank']").each(function(i, element){resetBlankLinks(element);});
            });
            
            function resetBlankLinks(element){
              element.setAttribute('onclick','eval("'+element.href+'")');
              element.target="_self";
            }
            
            function somefunction(relativePath) {
              window.open(document.referrer.match(/h(.[^/]+)/)[0] + "//" + document.referrer.match(/:\/\/(.[^/]+)/)[1] + relativePath);
            }
            
            
            
            
            
            
            
            

             

            now your qlikview table link will be

            '☍<url>javascript:void(somefunction("/SomeRelativePath/?SomeParam='&[SomeId]&'"))'
            
            
            
            
            

             

            this is a solution that lets you go to a function you decide and do whatever you want, but i also slows down the dom a bit.

             

            2. this solution i like better, you can go to relevant qlikview scripts and change them (if your using the web client):

            go to

            C:\Program Files\QlikView\Server\QlikViewClients\QlikViewAjax

            now you need to search in files for

            v.target="_blank"

            i found:

            1. C:\Program Files\QlikView\Server\QlikViewClients\QlikViewAjax\htc\QvAjax.js
            2. C:\Program Files\QlikView\Server\QlikViewClients\QlikViewAjax\mobile\js\smalldevices.js
            3. the Qv.exe you cant change and this is not used in the web client

             

            in each file you will find few locations (should be 2), i'v changed them
            from:

            v.target="_blank";
            
            
            
            

            to:

            v.target="_self";v.onclick=eval(m.url);
            
            
            
            

             

            and my BI url is now:

            '☍<url>javascript:void(window.open(document.referrer.match(/h(.[^/]+)/)[0] + "//" + document.referrer.match(/:\/\/(.[^/]+)/)[1] + "/SomeRelativePath/?SomeParam='&[SomeId]&'"));'
            
            
            
            

             

            see if this helps you, maybe you will want different stuff but this is how you can do it.

            for example i don't think you want the 'window.open' and you might want to use different target, see:
            HTML a target Attribute

             

            in any case you can open chrome developer tools (F12) to see the code that is created:

            <a href='javascript:void(window.open(document.referrer.match(/h(.[^/]+)/)[0]%20+%20&quot;//&quot;%20+%20document.referrer.match(/:\/\/(.[^/]+)/)[1]%20+%20&quot;/SomeRelativePath/?SomeParam=SomeId&quot;));'
            target="_self"
            onclick="eval(&quot;javascript:void(window.open(document.referrer.match(/h(.[^/]+)/)[0] + &quot;//&quot; + document.referrer.match(/:\/\/(.[^/]+)/)[1] + &quot;/SomeRelativePath/?SomeParam=SomeId&quot;));&quot;)"
            unselectable="on" style="position: absolute;">
              <div title="☍"
              style="background-color: rgb(255, 255, 255); color: rgb(0, 0, 0); text-align: right; font-style: normal; font-weight: normal; text-decoration: underline; cursor: pointer; position: absolute; overflow: hidden; left: 0px; top: 128px; width: 20px; height: 16px;">
              <div unselectable="on" style="position: absolute; left: 0px; top: 0px; width: 20px; height: 16px;"></div>
              <div class="injected" style="padding: 0px 2px; width: 16px; height: 16px; display: table-cell; vertical-align: middle;">
              <div unselectable="on" title="☍"
              style="width: 16px; cursor: default; white-space: pre; overflow: hidden; word-wrap: normal;">
              <a href='javascript:void(window.open(document.referrer.match(/h(.[^/]+)/)[0]%20+%20&quot;//&quot;%20+%20document.referrer.match(/:\/\/(.[^/]+)/)[1]%20+%20&quot;/SomeRelativePath/?SomeParam=SomeId&quot;));'
              target="_self"
              onclick="eval(&quot;javascript:void(window.open(document.referrer.match(/h(.[^/]+)/)[0] + &quot;//&quot; + document.referrer.match(/:\/\/(.[^/]+)/)[1] + &quot;/SomeRelativePath/?SomeParam=SomeId&quot;));&quot;)">
              ☍</a>
              </div>
              </div>
              </div>
            </a>