4 Replies Latest reply: Jan 17, 2014 5:21 AM by Antoine GOUEDARD RSS

    extract document name using QV JS API

    Jesper Bagge

      I've been scouring the web for quite some time trying to find a method to grab the document name using the QV JS API.

      I'm developing a document extension and could really use a more complete documentation than the official one found here: QlikView JavaScript API Reference - Version 11


      Does anyone happen to know how to get the document name?



        • Re: extract document name using QV JS API

          Hi Jesper,


          1. Create a variable like 'DocName' in the application

          2. Create a document event Trigger on 'onOpen'. Add the action 'Set variable', fill it with the name of the variable and for the value something like '=DocumentName()'

          3. on the extension side in the file script.js, in the Qva.AddDocumentExtension function part,  add this code :


          MyDoc = Qv.GetCurrentDocument();

          MyDoc.GetAllVariables(function(vars) {


                      for (var i = 0; i < vars.length; i++) {

                          var obj = vars[i];


                          if ( obj.name == 'DocName' ) {

                              // var text = obj.text;

                              MyDocumentName= obj.value;                  





          And you should get the name of the document in the MyDocumentName javascript object


          Hope it's help !

          • Re: extract document name using QV JS API
            Jesper Bagge

            In the end I found two usable solutions, thanks to Firebug.


            If you're interested, you can call either:

            window.document.title or window.qva.View

            to get some interesting values. However - neither of them works very well in web-view on local desktop.