CapabilityAPI

v1.5.0

js/qlik

module

External interface to qlik, for mashups and including qlik in foreign web pages.

Properties

navigation

No description

theme

No description

var config = {
     host: "myhost.com",
     prefix: "/",
     port: window.location.port,
     isSecure: true
};
requirejs(["js/qlik"], function(qlik) {
     // open the app
  var app = qlik.openApp("c31e2aba-3b46-4b13-8b87-c5c2514dea1d", config);
     // insert Qlik objects into the page.
     app.getObject(document.getElementById("LB01"), "uPyZavD");
}
deprecated

Call Qlik repository.

Parameters

path
string

Path to the Qlik Sense repository. Refer to Qlik Sense repository documentation for the available paths.

method
optional, default='GET'
string

HTTP method.

body
optional
string

Body of the post.

Returns

Promise<object>

A promise of a Qlik repository reply.

qlik.callRepository("/qrs/extension/schema").then(function(reply) {
        console.log(JSON.stringify(reply));
      });

Get a reference to the current app. Use in an extension to get a reference to the app displayed.

Parameters

reference
optional
object

Reference to extension object. Since Qlik Sense 1.1

Returns

An App JavaScript object with app methods.

var app = qlik.currApp(this);
   app.clearAll();

Get a list of Qlik apps and registers a callback to receive the data.
The reply will contain all apps the user has access to.

Parameters

callback
function

Callback method.

config
optional

Additional configuration parameters:

var config = {
        host: "myhost.com",
        prefix: "/",
        port: window.location.port,
        isSecure: true
    };
 qlik.getAppList(function(list){
        var str = "";
        list.forEach(function(value) {
            str +=  value.qDocName + "("+ value.qDocId +") ";
        });
        console.log(str);
    }, config);
deprecated

Get the list of extensions installed in the system.
The reply will contain all extensions: visualizations, mashups etc

Parameters

callback
optional
function

Callback method.

Returns

Promise

A promise of a Qlik engine reply.

qlik.getExtensionList(function(list){
        var str = "";
        list.forEach(function(value) {
            str +=  value.id + "(" + value.data.type + ") ";
        });
        console.log(str);
    });

Opens a connection with a Web Socket to engine for global methods

Parameters

config
optional

Additional configuration parameters:

Returns

A global JavaScript object with global methods.

var config = {
        host: "myhost.com",
        prefix: "/",
        port: window.location.port,
        isSecure: true
      };
   var global = qlik.getGlobal(config);
   global.getAuthenticatedUser(function(reply){
        console.log("User:"+reply.qReturn);
      });

Get a list of themes from the system. The list will contain both default and custom themes.

Returns

Promise

A promise of a list of themes including the ID and the metadata name.

qlik.getThemeList().then(function(list){
        var str = "";
        list.forEach(function(value) {
            str += value.name + '(' + value.id + ")\n";
        });
        console.log(str);
    });

Remove listener(s) for the qlik instance events.

Parameters

eventName
optional
string

Name of the event. If no eventName is provided, removes all listeners.

qlik.on("error", err=>{
  console.error(err);
});
qlik.off("error");

Add listener(s) to the qlik instance events. Possible events are error, warning and closed. Multiple listeners can be added to an event.

Parameters

eventName
string

Name of the event. Can be: error, warning, closed. Note: this event handler will be overridden by app event handlers or global event handlers if set.

callback
function

Callback method.

qlik.on("error", err=>{
  console.error(err);
});
qlik.on("warning", warn=>{
  console.warn(warn);
});

Opens the app. You can open multiple apps. Most other methods are defined on the app. Introduced in Qlik Sense 1.0.

Parameters

appId
string

The app Id

config
optional

Additional configuration parameters:

Returns

An App JavaScript object with app methods.

var app = qlik.openApp("2abac31e-3b46-4b78-8bxf-c5cea1d2514d");
     var config = {
          host: "myhost.com",
          prefix: "/",
          port: window.location.port,
          isSecure: true
        };
     var app2 = qlik.openApp("c31e2aba-3b46-4b13-8b87-c5c2514dea1d", config);

Promise utility that can be used for asynchronous operations. Very useful for the paint method to
tell the rendering is complete. Full documentation available on:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise.

Parameters

executor
function

The executing function with two parameters, resolve and reject.

var Promise = qlik.Promise;
qlik.registerExtension("dumpchart",
       {
        paint:function($element,layout) {
            return new Promise(function(resolve, reject) {
                setTimeout(function() {
                    $element.html(JSON.stringify(layout));
                    resolve(); // Extension painted successfully
                }, 1000);
            });
        }
   });

Register an extension for use in this mashup.
The extension will not be installed on Qlik Sense server, but only available in the session where it
is created.

Parameters

id
string

Set the ID of the visualization extension.

impl
object

Set the extension implementation.

metadata
optional, default={"type":"visualization"}
object

Extension metadata, same format as QEXT file.

qlik.registerExtension("dumpchart",

   {
       paint:function($element,layout){
           $element.html(JSON.stringify(layout));
       }
   });
requirejs([path +"/wordcloud/wordcloud.js"],function(wordcloud)
{
   qlik.registerExtension( "wordcloud", wordcloud );
});

Sends a resize event to all Qlik objects.

Parameters

ID
optional
string

Object id. Optional: if no ID, resize event will be sent to all objects.

//create the tabs and make qlik objects resize
 //when a new tab is selected
 $("#tabs").tabs().bind("tabsselect", function(event, ui) {
        qlik.resize();
    });

Creates a session/cached QApp object

Parameters

config
optional

Additional configuration parameters:

Returns

An app JavaScript object with app methods.

Basic usage


var sessionApp = qlik.sessionApp();

Basic usage with config


var config = {
  host: "myhost.com",
  prefix: "/",
  port: window.location.port,
  isSecure: true
};
var sessionApp =  qlik.sessionApp(config);

Creates a session/cached QApp object from an existing app

Parameters

appId
string

App id of the app to base the session app upon.

config
optional

Additional configuration parameters:

Returns

An app JavaScript object with app methods.

Basic usage


var sessionApp = qlik.sessionAppFromApp("2abac31e-3b46-4b78-8bxf-c5cea1d2514d");

Basic usage with config


var config = {
  host: "myhost.com",
  prefix: "/",
  port: window.location.port,
  isSecure: true
};
var sessionApp = qlik.sessionAppFromApp("2abac31e-3b46-4b78-8bxf-c5cea1d2514d", config);

Multiple apps


var sessionApp = qlik.sessionAppFromApp("2abac31e-3b46-4b78-8bxf-c5cea1d2514d");
var sessionApp2 = qlik.sessionAppFromApp("c31e2aba-3b46-4b13-8b87-c5c2514dea1d");

Sets device type, which modifies the UI accordingly.
The device type is automatically detected if it is not manually set.

Parameters

deviceType
string

Type of device. One of: auto, touch, desktop.

qlik.setDeviceType('desktop');

Set language.

Parameters

lang
string

Language code

qlik.setLanguage("es");
deprecated

Parameters

onError
function

Error handling function

onWarning
optional
function

Warning handling function. Since Qlik Sense 2.1

qlik.setOnError(function(error) {
  //contains code, message
     console.log(error.message);
},
function(warning){
     windows.console.log(warning);
});

Create a QTable object that wraps data in your extension and provides an object-oriented interface.

Parameters

ext
object

Extension or angular scope for the extension.

path
optional, default='qHyperCube'
string

Path to the hypercube.

Returns

table - A QTable object that holds data and options for the table.

$scope.table = qlik.table(this);

<tr ng-repeat="row in table.rows">
   <td ng-repeat="cell in row.cells"> {{cell.qText}} </td>
</tr>

Observe a Notification by sending in an observer function.

Parameters

observer
function

The observer function to handle to notification.

Stop observing a notification.

Parameters

observer
function

The observer function that now should ignore any future notifications.

Describes the size, in millimeters (mm), of a 2D object.

Properties

height
number

Object height in millimeters (mm).

width
number

Object width in millimeters (mm).

Describes the size, in pixels, of a 2D object.

Properties

height
number

Object height in pixels.

width
number

Object width in pixels.

Properties

bookmark

No description

theme

No description

variable

No description

visualization

No description

Add an alternate state.

Introduced in Qlik Sense 1.1

Parameters

qStateName
string

Alternate state name.

Returns

Promise

A promise of a Qlik engine reply.

app.addAlternateState("X");

QAppback
()

function

Back to prev selection

Returns

Promise

A promise of a Qlik engine reply.

var app = qlik.openApp('2abac31e-3b46-4b78-8bxf-c5cea1d2514d');
app.back();

Clear all selections

Parameters

lockedAlso
optional, default=false
boolean

Also clear locked fields. Since Qlik Sense 2.1

state
optional, default='$'
string

Alternate state name. Since Qlik Sense 2.1

Returns

Promise

A promise of a Qlik engine reply.

var app = qlik.openApp('2abac31e-3b46-4b78-8bxf-c5cea1d2514d');
app.clearAll();

QAppclose
()

function

Close an app

Will also close the web socket and clear out client side data.

Introduced in Qlik Sense 1.1

Returns

Promise

A promise of a Qlik engine reply.

var app = qlik.openApp('2abac31e-3b46-4b78-8bxf-c5cea1d2514d');
app.close();

Defines a Qlik Hypercube and registers a callback to receive the data.

Parameters

qHyperCubeDef
object

Cube definition.

callback
optional
function

Callback method. Parameter will contain a qHyperCube.

Returns

Promise

A promise of an object model.

app.createCube({
  qDimensions : [{
    qDef : {
      qFieldDefs : ["FirstName"]
    }
  }, {
    qDef : {
      qFieldDefs : ["LastName"]
  }
}],
qMeasures : [{
  qDef : {
    qDef : "1"
  }
}],
qInitialDataFetch : [{
  qTop : 0,
  qLeft : 0,
  qHeight : 20,
  qWidth : 3
}]
}, function(reply) {
  var str = "";
  $.each(reply.qHyperCube.qDataPages[0].qMatrix, function(key, value) {
    str += '<li>' + value[0].qText + ':' + value[1].qText + '</li>';
  });
  $('#list').html(str);
});

Creates a Qlik Generic object and registers a callback to receive the data.
The generic object can contain qHyperCubeDef, qListObjectDef and/or
qStringExpression and qValueExpression.
It will be a session object and disppears when the session is closed.
The callback method will be called whenever the selection state changes in a way
that affects the generic object. The parameter will be the evaluated version of the definition.

Parameters

param
object

Generic object definition.

callback
optional
function

Callback method.

Returns

Promise

A promise of an object model.

app.createGenericObject( {
  user: {
    qStringExpression: "=QVUser ()"
  },
  version : {
    qStringExpression: "=QlikViewVersion ()"
  },
  fields: {
    qValueExpression: "=Count (DISTINCT $Field)"
  }
}, function ( reply ) {
  var str = "Version:" + reply.version + " Fields:" + reply.fields;
  if ( reply.user ) {
    str += " User:" + reply.user;
  }
  $( "#info" ).html(str);
});

Defines a Qlik list of field values and registers a callback to receive the data.

Parameters

qListObjectDef
object

List definition.

callback
optional
function

Callback method. Parameter will contain a qListObject.

Returns

Promise

A promise of an object model.

app.createList({
  "qDef": {
    "qFieldDefs": [
      "LastName"
    ]
   },
   "qInitialDataFetch": [{
     qTop : 0,
     qLeft : 0,
     qHeight : 20,
     qWidth : 1
   }]
   }, function(reply) {
     var str = "";
     $.each(reply.qListObject.qDataPages[0].qMatrix, function(key, value) {
       str += '<li>' + value[0].qText + '</li>';
     });
     $('#list').html(str);
   });

Defines a Qlik Hypercube and creates a table object wrapping the hypercube.

Introduced in Qlik Sense 2.1

Parameters

dimensions
Array<any>

Dimensions to use. Should, for each entry, be a field name or a NxDimension structure

measures
Array<any>

Measures to use. Should, for each entry, be an expression or a NxMeasure structure.

options
optional
object

Options to set.

Returns

A table object of type QTable, which is initially empty but eventually will contain data. The table object will be updated when selection state changes.

var users = app.createTable(["FirstName", "LastName"], ["Count(Case Id)"],{rows:200});

Destroys a Qlik Session object created with createGenericObject or any of
createCube, createList, getList calls.

The object will be removed from engine, no more updates will be sent to the client
and all methods on the object will be invalid.

Introduced in Qlik Sense 1.1.

Parameters

id
string

Session object ID.

Returns

Promise

A promise of a Qlik engine reply.

app.destroySessionObject( 'xcVtY');
app.destroySessionObject(reply.qInfo.qId);

Reload the app

Introduced in Qlik Sense 1.1

Parameters

qMode
optional
number

Error handling mode: 0 = default mode, 1 = attempt recovery on all errors, 2 = fail on all errors.

qPartial
optional
boolean

Set to true for partial reload.

qDebug
optional
boolean

Set to true if debug breakpoints are honored. Execution of the script will be in debug mode.

Returns

Promise

A promise of a Qlik engine reply.

app.doReload();

Save the app

Introduced in Qlik Sense 1.1

Parameters

qFileName
optional
string

File name of the file to save.

Returns

Promise

A promise of a Qlik engine reply.

app.doReload().then(function(){
   app.doSave();
});

Get a field reference with methods to manipulate field.

Parameters

fld
string

Name of the field.

statename
optional, default='$'
string

Alternate state name.

Returns

A QField object with methods and properties that can be used to manipulate the field.

Forward

Returns

Promise

A promise of a Qlik engine reply.

var app = qlik.openApp('2abac31e-3b46-4b78-8bxf-c5cea1d2514d');
app.forward();

Get layout for this app and register a callback to receive the data.

Introduced in Qlik Sense 1.1

Parameters

callback
optional
function

Callback method.

Returns

Promise

A promise of a Qlik engine reply.

app.getAppLayout(function(layout){
  console.log(layout.qTitle);
});
deprecated

Get a list of Qlik application Objects and registers a callback to receive the data.

Parameters

type
optional, default='sheet'
string

Type of object. One of: sheet, MasterObject.

callback
optional
function

Callback method.

app.getAppObjectList( 'sheet', function(reply){
  var str = "";
  $.each(reply.qAppObjectList.qItems, function(key, value) {
    str +=  value.qData.title + ' ';
    $.each(value.qData.cells, function(k,v){
      str +=  v.name + ' ';
    });
  });
  console.log(str);
});

Get properties for a Qlik object including children properties.

Parameters

id
string

Object ID.

Returns

Promise

A promise of an object model.

app.getFullPropertyTree(value.qInfo.qId).then(function(model){
  console.log(model.propertyTree.qChildren.length + ' children');
});

Get a list of internal Qlik objects and registers a callback to receive the data.

Parameters

type
string

Type of object. One of: FieldList, MeasureList, DimensionList,
BookmarkList, SelectionObject, SnapshotList Since Qlik Sense 1.1,
MediaList Since Qlik Sense 1.1, sheet Since Qlik Sense 1.1, MasterObject Since Qlik Sense 1.1,
VariableList Since Qlik Sense 2.0, story Since Qlik Sense 2.1

callback
optional
function

Registers a callback that is executed every time data is returned.

Returns

Promise

A promise of an object model.

app.getList("FieldList", function(reply){
  var str = "";
  $.each(reply.qFieldList.qItems, function(key, value) {
    str +=  value.qName + ' ';
  });
 console.log(str);
});

Inserts a Qlik object into a HTML element.
The object will fill the HTML object, so you can size and position
the element to determine how large the Qlik object will be.

If you only supply one parameter you will just get the model without displaying the object.

Parameters

elem
optional
HTMLElement | string

HTML element. Since version 1.1 it is also possible to define a string of the HTML element id.

id
string

Object ID or 'CurrentSelections' if used for Selections bar. Since version November 2017 it is also possible to use 'AppNavigationBar' to on-demand app navigation bar.

options
optional

Additional options:

Returns

Promise

A promise of an object model.

app.getObject(document.getElementById("LB01"), "uPyZavD");
app.getObject("LB01","uPyZavD");
app1.getObject('MyAppNavigationToolbarDIVid', 'AppNavigationBar', { sheetId: "RWcstb", openAppCallback: function ( appId, targetSheetId ) {
  console.log("Open generated app event handled.  App ID: " + appId + " target sheet to open by default: " + targetSheetId);
}});

Get properties for a Qlik object.

Parameters

id
string

Object ID.

Returns

Promise

A promise of an object model.

app.getObjectProperties("uPyZavD").then(function(model){
  this.title = model.properties.title;
});

Gets the data load script of this app.

Introduced in Qlik Sense 4.0

Returns

Promise

A promise of a qScript object with the load script values.

var app = qlik.openApp( "MY_APP_ID");
app.getScript().then( function(script){
  console.log(script);
});

Inserts a Qlik snapshot into a HTML element.
The snapshot will fill the HTML object, so you can size and position
the element to determine how large the Qlik object will be.

If you only supply one parameter you will just get the model without displaying the object.

Parameters

element
optional
HTMLElement | string

HTML element or string with HTML element id.

id
string

Snapshot ID.

Returns

Promise

A promise of an object model.

app.getSnapshot(document.getElementById("SNAPSHOT"), "uPyZavD");

Lock all selections

Parameters

state
optional, default='$'
string

Alternate state name. Since Qlik Sense 2.1

Returns

Promise

A promise of a Qlik engine reply.

var app = qlik.openApp('2abac31e-3b46-4b78-8bxf-c5cea1d2514d');
app.lockAll();

Remove listener(s) for the app events.

Introduced in Qlik Sense February 2018

Parameters

eventName
optional
string

Name of the event. Can be: error, warning, closed. If no eventName is provided, removes all listeners.

var app = qlik.openApp("MY_APP_ID");
app.on("error", function ( error ) {
  console.log("error listener called for app", error);
});
app.off("error");

Add listener(s) to the app events. Possible events are error, warning and closed. Multiple listeners can be added to an event.

Introduced in Qlik Sense February 2018

Parameters

eventName
string

Name of the event. Can be: error, warning, closed.

callback
function

Callback method.

var app = qlik.openApp("MY_APP_ID");
app.on("error", function ( error ) {
  console.log("error listener called for app", error);
});
app.on("warning", function ( warning ) {
  console.log("warning listener called for app", warning);
});
app.on("closed", function ( closed ) {
  console.log("closed listener called for app", closed);
});

Remove an alternate state

Introduced in Qlik Sense 1.1

Parameters

qStateName
string

Alternate state name

Returns

Promise

A promise of a Qlik engine reply.

app.removeAlternateState("X");
deprecated

Searches for one or more terms in the values of an app.

Introduce in Qlik Sense 1.1

Parameters

qTerms
Array<any>

Terms to search for.

qPage

No description

qOptions
optional

Search options

callback
optional
function

Callback method.

Returns

Promise

A promise of a Qlik engine reply.

app.searchAssociations(["se"],
  {qOffset:0,qCount:15,qMaxNbrFieldMatches:5},
  {qContext: 'CurrentSelections'},
  function(reply){
    var str = "";
    reply.qResults.qFieldDictionaries.forEach(function(dic){
      dic.qResult.forEach(function(result){
        str += result.qText;
      });
    });
    console.log(str);
});

Searches for one or more terms in the values of an app.

Introduced in Qlik Sense 2.2

Parameters

qTerms
Array<any>

Terms to search for.

qPage

No description

qOptions
optional

Search options.

callback
optional
function

Callback method.

Returns

Promise

A promise of a Qlik engine reply.

app.searchResults( ["ma"],
  { qOffset: 0, qCount: 15},
  {qContext: 'CurrentSelections'},
  function ( reply ) {
    if ( reply.qResult.qTotalNumberOfGroups === 0 ) {
      console.log('No matches');
    } else {
      var str = "";
      reply.qResult.qSearchGroupArray.forEach( function ( value ) {
        value.qItems.forEach( function ( item ) {
          str += item.qIdentifier +": ";
          item.qItemMatches.forEach( function ( match ) {
            str += match.qText + ' ';
          });
        });
      });
      console.log(str);
    }
});

Returns search suggestions.

Introduced in Qlik Sense 1.1

Parameters

qTerms
Array<any>

Terms to search for.

qOptions
optional

Search options.

callback
optional
function

Callback method.

Returns

Promise

A promise of a Qlik engine reply.

app.searchSuggest(["se"], {}, function(reply) {
  var str = "";
  reply.qResult.qSuggestions.forEach(function(sugg){
    str += sugg.qValue + ' ';
  });
  console.log(str);
});

Make a selection based on searchAssociaton results

Introduced in Qlik Sense 1.1

Parameters

qMatchIx
optional
number

Index to search result.

qTerms
optional
Array<any>

Values to select.

qOptions
optional

Parameter sent to the Qlik engine containing information about the search fields and the search context.

qSoftLock
optional
boolean

Use the qOptions.qContext parameter instead.

Returns

Promise

A promise of a Qlik engine reply.

app.selectAssociations( 0, ["May","Mar"] );

Creates a SelectionState object that encapsulates the selection state.

Introduced in Qlik Sense 2.2

Parameters

state
optional, default='$'
string

Sets the state.

Returns

A selection state object for the selection state of type QSelectionState.

Sets the data load script of this app. Also validates the script syntax and returns the syntax errors if errors exist.

Introduced in Qlik Sense 4.0

Parameters

script
string

The script content.

Returns

Promise

A promise of an empty object or a list of syntax errors depending on the validation result.

Load script inline


var script = "Load Chr(RecNo()+Ord('A')-1) as Alpha, RecNo() as Num autogenerate 26;"
var app = qlik.openApp( "MY_APP_ID");
app.setScript(script).then( function(result){
    console.log(result);
});

Load script from file


var script = 'LOAD Sales FROM [lib://data/sample.xlsx];';
var app = qlik.openApp( "MY_APP_ID");
app.setScript(script).then( function(result){
  console.log(result);
});

Unlock all selections

Parameters

state
optional, default='$'
string

Alternate state name. Since Qlik Sense 2.1

Returns

Promise

A promise of a Qlik engine reply.

var app = qlik.openApp('2abac31e-3b46-4b78-8bxf-c5cea1d2514d');
app.unlockAll();

Get theme as a QTheme object

Parameters

id
optional
string

Theme id. If no id is specified, the theme saved for the app is returned.

Returns

Promise<QTheme>

A promise of a QTheme object

app.theme.get('my-theme-id').then(function(qtheme){
   console.log('Theme background color: ' + qtheme.properties.backgroundColor);
    });

Get currently applied theme as a QTheme object

Returns

Promise<QTheme>

A promise of a QTheme object

app.theme.getApplied().then(function(qtheme){
   console.log('Current theme background color: ' + qtheme.properties.backgroundColor);
    });

Save a theme id to an app

Introduced in Qlik Sense February 2018

Parameters

id
string

Theme id

app.theme.save('my-theme-id');

Create a new visualization. The visualization will be based on a session object and not persisted in the app.

Parameters

type
string

Visualization type. Built-in visualization like barchart, piechart, linechart, combochart or an extension.

cols
optional
Array<any>

Column definitions, dimensions and measures. Each entry can be a string, a NxDimension
or NxMeasure structure. If the NxDimension or NxMeasure refers to a library dimension or measure
you also might nedd to add qType measure or dimension.

options
optional

Options to set. Refer to documentation for the visualization used for additional options.

Returns

A promise of a {@link QVisualization}.

create a barchart on the fly
var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.visualization.create('barchart',["Case Owner Group","=Avg([Case Duration Time])"],{title:"Great on-the-fly barchart"}).then(function(bar){
  bar.show('QV04');
});
create a table
app.visualization.create( 'table', ["Case Owner Group", "=Avg([Case Duration Time])", "Priority", "Quarter"] ).then( function ( table ) {
  table.show( 'QV04' );
});
create a toolbar using an extension
app.visualization.create('com-qliktech-toolbar',null,
  {"buttons":{"clear":true,"back":true,"forward":true}}).then(function(vis){
    vis.show("QV05");
});

Get an existing visualization

Introduce in Qlik Sense 2.2

Parameters

id
string

Id for an existing visualization

Returns

A promise of a {@link QVisualization}

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
   app.visualization.get('xGhjKl').then(function(vis){
     vis.show("QV01");
   });

Apply bookmark

Parameters

id
string

Bookmark id

Returns

Promise

A promise of a Qlik engine reply. Since Qlik Sense 1.2

var app = qlik.openApp("c31e2aba-3b46-4b13-8b87-c5c2514dea1d");
app.bookmark.apply("pPvpTN");

Create bookmark based on current selection

Parameters

title
string

Bookmark title

description
string

Bookmark description

sheetId
optional
string

Bookmark sheet ID. Since Qlik Sense 2.2

Returns

Promise

A promise of a Qlik engine reply. Since Qlik Sense 1.2

var app = qlik.openApp("c31e2aba-3b46-4b13-8b87-c5c2514dea1d");
app.bookmark.create("Test","Test bookmark","fmcJkH");

Remove bookmark

Parameters

id
string

Bookmark id

Returns

Promise

A promise of a Qlik engine reply. Since Qlik Sense 1.2

var app = qlik.openApp("c31e2aba-3b46-4b13-8b87-c5c2514dea1d");
app.bookmark.remove("pPvpTN");

Wrapper around a HyperCube dimension cell.

Properties

qText
string

Cell value formatted as set up in properties.

qElemNumber
number

Cell value index.

qState
string

Cell state.

qNum
optional
number

Cell numeric value, if cell is numeric.

Select the value contained in this cell.

<div class="selectable" ng-class="{'selected':cell.selected}" ng-click="cell.select($event)">{{cell.qText}}</div>

External interface to the fields in a Qlik Sense app and contain methods for field level commands.

Properties

OnData

OnData notification

qStateCounts
object

Object with number of values in different states. Only after getData() call.

Introduced in Qlik Sense 2.1

rowCount
number

Number of different values. Only after getData() call.

Introduced in Qlik Sense 2.1

rows
Array<any>

Field values. You need to call getData() method to make this available. Since Qlik Sense 2.1

Clears a field selection

Returns

Promise

A promise of an engine response

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.field('LastName').clear();

Clears all field selections except this one

Parameters

softlock
optional
boolean

If true, locked selections can be overridden.

Returns

Promise

A promise of an engine response

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.field('LastName').clearOther(true);

Gets field data.
The values are available as QFieldValue in array field.rows and is updated when the selection state changes.
Notification OnData will be triggered after each update.

Introduced in Qlik Sense 2.1

Parameters

options
optional

Object containing options for the getData call.

Returns

The field object

var app = qlik.openApp("c31e2aba-3b46-4b13-8b87-c5c2514dea1d");
$scope.months = app.field("Month").getData();

<button ng-repeat="row in months.rows" class="btn" ng-click="row.select();"
  ng-class="{'btn-success':row.qState === 'S'}">{{row.qText}}</button>

Get more data for your field.
Notification OnData will be triggered when complete.

Introduced in Qlik Sense 2.1

Returns

The field object

<button ng-if="fieldMonth.rowCount>fieldMonth.rows.length" ng-click="fieldMonth.getMoreData()">More</button>

QFieldlock
()

function

Locks a field selection

Returns

Promise

A promise of an engine response

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.field('LastName').lock();

Select field values using indexes

Parameters

Array
Array<any>

of indexes to values to select,

toggle
optional
boolean

If true, toggle selected state.

softlock
optional
boolean

If true, locked selections can be overridden.

Returns

Promise

A promise of an engine response

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.field('LastName').select([0, 1, 2], true, true);

Select all values in field

Parameters

softlock
optional
boolean

If true, locked selections can be overridden.

Returns

Promise

A promise of an engine response

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.field('LastName').selectAll();

Select alternative values in field

Parameters

softlock
optional
boolean

If true, locked selections can be overridden.

Returns

Promise

A promise of an engine response

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.field('LastName').selectAlternative();

Select excluded values in field

Parameters

softlock
optional
boolean

If true, locked selections can be overridden.

Returns

Promise

A promise of an engine response

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.field('LastName').selectExcluded();

Select matching field values

Parameters

match
string

Match string

softlock
optional
boolean

If true, locked selections can be overridden.

Returns

Promise

A promise of an engine response

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.field('LastName').selectMatch('A', true);

Select possible values in field

Parameters

softlock
optional
boolean

If true, locked selections can be overridden.

Returns

Promise

A promise of an engine response

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.field('LastName').selectPossible();

Select field values

Parameters

values
Array<any>

Array of qFieldValues to select. Since 1.1 a simplified syntax with strings OR numbers also works. Note that for a numeric field you need to provide the numeric value.

toggle
optional
boolean

If true, toggle selected state. If false replace the current selection.

softlock
optional
boolean

If true, locked selections can be overridden.

Returns

Promise

A promise of an engine response

app.field("Month").selectValues([5], true, true);
app.field(fld).selectValues(["Wetterberg"], true, true);

Toggle field selection

Parameters

match
string

Match string

softlock
optional
boolean

If true, locked selections can be overridden.

Returns

Promise

A promise of an engine response

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.field('LastName').toggleSelect('A', true);

Unlocks a field selection

Returns

Promise

A promise of an engine response

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.field('LastName').unlock();

Selection state for a field.

Introduced in Qlik Sense 2.2

Properties

fieldName
string

The field name.

qSortIndex
number

Sort index, starting from 0.

field

Reference to the field

locked
boolean

Is field locked?

isNumeric
boolean

Is field numeric?

totalCount
number

Total number of values in field.

selectedCount
number

Number of selected values.

qSelectionThreshold
number

Number of values that will be listed.

qStateCounts
object

Object with number of values in different states.

qSelected
string

Concatenated string of selected values if # of values are less than the threshold or string of format "7 of 123"

selectedValues
Array<any>

Array with a maximum of qSelectionThreshold values that are selected. For each value the text plus the selection mode (NORMAL/AND/NOT)

notSelectedValues
Array<any>

Array with a maximum of qSelectionThreshold values that are not selected. For each value the text plus the selection mode (NORMAL/AND/NOT)

Field value for a Qlik Field.

Properties

qText
string

Cell value formatted as set up in properties.

qElemNumber
number

Cell value index

qState
string

Cell state

qNum
optional
number

Cell numeric value, if cell is numeric.

qFrequency
optional
string

Frequency, if calculated by engine.

Select field value

Introduced in Qlik Sense 2.1

Parameters

toggle
optional
boolean

If true, toggle selected state.

softlock
optional
boolean

If true, locked selections can be overridden.

Returns

Promise

A promise

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
var field = app.field('LastName');
field.getData();
//after data is loaded fieldvalues will be in rows array
field.rows[0].select();

Cancel reload

Returns

Promise

A promise of a Qlik engine reply.

var global = qlik.getGlobal(config);
global.cancelReload();

Get app list

Parameters

callback
function

callback method

qlik.getGlobal(config).getAppList(function(list){
  var str = "";
  $.each(list, function(key, value) {
    str +=  value.qDocName + '('+ value.qDocId + ')';
  });
  console.log(str);
});

Get Authenticated User

Parameters

callback
optional
function

callback method

Returns

Promise

A promise of a Qlik engine reply.

var global = qlik.getGlobal(config);
global.getAuthenticatedUser(function(reply){
  console.log('User:'+reply.qReturn);
});
deprecated

Get Product Version

Introduced in Qlik Sense 1.2

Parameters

callback
optional
function

callback method

Returns

Promise

A promise of a Qlik engine reply.

var global = qlik.getGlobal(config);
global.getProductVersion(function(reply){
  console.log('Product Version:'+reply.qReturn);
});

Get Progress

Introduced in Qlik Sense 2.1

Parameters

qRequestId
number

RequestId from doReload call or 0. Complete information is returned if the identifier of the request is specified. If qRequestId = 0, less information is returned.

callback
optional
function

callback method

Returns

Promise

A promise of a Qlik engine reply.

var global = qlik.getGlobal(config);
global.getProgress();

Get QT Product

Parameters

callback
optional
function

callback method

Returns

Promise

A promise of a Qlik engine reply.

var global = qlik.getGlobal(config);
global.getQTProduct(function(reply){
  console.log('QT Product:'+reply.qReturn);
});

Get isPersonalMode

Parameters

callback
optional
function

callback method

Returns

Promise

A promise of a Qlik engine reply.

var global = qlik.getGlobal(config);
global.isPersonalMode(function(reply){
  console.log('Personal mode:'+reply.qReturn);
});

Remove listener(s) for the global events.

Introduced in Qlik Sense February 2018

Parameters

eventName
optional
string

Name of the event. Can be: error, warning, closed. Removes all listeners if no eventName is provided.

var global = qlik.getGlobal(config);
global.on("error", function (error) {
  console.log("error listener called for global", error);
});
global.off("error");

Adds listeners to the global events. Possible events are error, warning and closed. Multiple listeners can be added to an event.

Introduced in Qlik Sense February 2018

Parameters

eventName
string

Name of the event. Can be: error, warning, closed.

callback
function

Callback method.

var global = qlik.getGlobal(config);
global.on("error", function (error) {
  console.log("error listener called for global", error);
});
global.on("warning", function (warning) {
  console.log("warning listener called for global", warning);
});
global.on("closed", function (closed) {
  console.log("closed listener called for global", closed);
});

Apply a theme to all visualizations on the web page

Parameters

id
string

Id of theme to apply.

Returns

Promise<boolean>

Promise of a boolean to indicate success or not

qlik.theme.apply('my-theme-id').then(function(result){
  console.log('theme applied with result: ' + result);
});

Get theme as a QTheme object

Parameters

id
string

Theme id

Returns

Promise<QTheme>

A promise of a QTheme object

qlik.theme.get('my-theme-id').then(function(qtheme){
  console.log('Theme background color: ' + qtheme.properties.backgroundColor);
});

Wrapper around a HyperCube header cell.

Introduced in Qlik Sense 2.1

Properties

qFallbackTitle
string

Column title.

qSortIndicator
string

A: ascending, D:Descending

isOrderedBy
boolean

Is this the first column for sort?

qReverseSort
boolean

Is sort order currently reversed for this column?

col
number

Column number.

qCardinal
optional
number

Number of different values. Only for dimensions.

qStateCounts
optional
object

Object with number of values in different states. Only for dimensions.

field
optional

Field object with methods to manipulate the underlying field. Only used for dimensions.

qMin
optional
number

Minimum value. Only for measures.

qMax
optional
number

Maximum value. Only for measures.

errorCode
optional
number

Error code for this column. Only if column has an error. Since Qlik Sense 2.2

errorMessage
optional
string

Error message for this column. Only if column has an error. Since Qlik Sense 2.2

<th ng-repeat="head in data.headers" class="header" ng-click="head.orderBy()">
  {{head.qFallbackTitle}}
       <i ng-if="head.isOrderedBy" ng-click="head.reverseOrder()"
           ng-class="{ 'icon-triangle-top': head.qSortIndicator === 'A',
            'icon-triangle-bottom': head.qSortIndicator === 'D'}">
       </i>
</th>

Set this column to be the first in the sort order.

Reverse the sorting order for the column.

Select a range in this measure.

Parameters

min
number

Sets the minimum value of the range.

max
number

Sets the maximum value of the range.

inclMin
optional
boolean

Set to true to include minimum value.

inclMax
optional
boolean

Set to true to include maximum value.

Returns

Promise

No description

this.table.headers[1].selectRange( this.minval, this.maxval );

Wrapper around a HyperCube measure cell.

Properties

qText
string

Cell value formatted as set up in properties.

qNum
optional
number

Cell numeric value, if cell is numeric.

Get the value of this cell as percent of total. Note that this might be more than 100% if this is an average.

<div class="bar" style="width:{{row.measures[0].getPercent()}}%">

Get the value of this cell as percent of maximum.

<div class="bar" style="width:{{row.measures[0].getPercentOfMax()}}%">

Properties

ANALYSIS
string

Used for analysis mode.

EDIT
string

Used for edit mode.

Get current sheet ID.

Returns

The result of the navigation

var result = qlik.navigation.getCurrentSheetId();
console.log('sheet id: ' + result.sheetId);

Get current mode.

Returns

string

mode The current mode

var mode = qlik.navigation.getMode();
console.log('mode: ' + mode);

Navigates to a given sheet in the current app.
Note that the method will return before the actual navigation takes place.

Parameters

sheetId
string

The ID of the sheet to navigate to.

Returns

The result of the navigation operation.

var navigationResult = qlik.navigation.gotoSheet('xYgfJ');

Navigates to a given story in the current app.
Note that the method will return before the actual navigation takes place.

Parameters

storyId
string

The ID of the story to navigate to.

Returns

The result of the navigation operation.

var navigationResult = qlik.navigation.gotoStory('xYgfJ');

Checks if a given mode is allowed.

Parameters

mode
string

The mode to check availability of. Can be either {@link QNavigaton#EDIT} or {@link QNavigaton#ANALYSIS}.

Returns

boolean

If the mode is allowed or not.

if (qlik.navigation.isModeAllowed(QNavigation#EDIT)) {
  //enable edit button
};

Navigates to the next sheet in the current app. It will do nothing if you do not have sheets in the current context.
Note that the method will return before the actual navigation takes place.

Returns

The result of the navigation operation.

var navigationResult = qlik.navigation.nextSheet();

Navigates to the previous sheet in the current app. It will do nothing if you do not have sheets in the current context.
Note that the method will return before the actual navigation takes place.

Returns

The result of the navigation operation.

var navigationResult = qlik.navigation.prevSheet();

Set current mode.

Parameters

mode
string

The mode to change to. Can be either {@link QNavigation#EDIT} or {@link QNavigation#ANALYSIS}.

Returns

The result of the mode change.

var result = qlik.navigation.setMode(QNavigation#EDIT);
console.log('mode: ' + result.mode);

Return value from mode related navigation methods.

Properties

success
boolean

true if the operation was successful.

mode
optional
string

The new mode. Can be either {@link QNavigation#EDIT} or {@link QNavigation#ANALYSIS}.

error
optional
string

The error code if an error occurred, for example MODENOTALLOWED.

errorMsg
optional
string

The error message, for example 'Mode not allowed'.

Return value from sheet navigation methods.

Properties

success
boolean

true if the navigation was successful.

sheetId
optional
string

The new sheet ID.

error
optional
string

The error code if an error occurred, for example NOSUCHSHEET or NOCURRENTSHEET.

errorMsg
optional
string

The error message, for example 'No current sheet'.

Return value from story navigation methods.

Properties

success
boolean

true if the navigation was successful.

storyId
optional
string

The new story ID.

error
optional
string

The error code if an error occurred, for example NOSUCHSTORY.

errorMsg
optional
string

The error message, for example 'No such story'.

Wrapper around a HyperCube data row.

Properties

dimensions
Array<any>

Dimension cells.

measures
Array<any>

Measure cells.

cells
Array<any>

All cells, in the order defined in properties.

<div ng-repeat="row in data.rows" class="row"  title="{{row.dimensions[0].qText}}"
   data-value="{{ row.dimensions[0].qElemNumber }}">
   <div class="bar" style="width:{{row.measures[0].getPercent()}}%">
       <span>{{row.dimensions[0].qText}}</span>
   </div>
   <div class="per">
       <span class="{{row.measures[0].getPercent()>95 ? 'over':'' }}">{{row.measures[0].qText}}</span>
   </div>
</div>

The SelectionState API allows developers to work with selection state data returned from the Qlik engine without having deeper
knowledge of internal constructs.

Notification is sent when data is available. Notification will be triggered after each update. To receive
notification bind a listener on 'OnData' of QSelectionState instance.

Properties

stateName
string

State name, '$' for default state.

selections
Array<any>

Selections

backCount
number

Number of back steps available.

forwardCount
number

Number of forward steps available.

OnData

OnData notification

// create an object
const selState = app.selectionState();

const listener = function() {
  console.log('Back count:' + selState.backCount);
  selState.OnData.unbind( listener );  //unregister the listener when no longer notification is needed.
};
selState.OnData.bind( listener ); //bind the listener
Example based on using AngularJS.

Your main script:

$scope.selState = app.selectionState();

In your AngularJS template:
<button type="button" class="btn btn-default btn-xs" ng-click="selState.clearAll()" aria-label="Clear">
  <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
</button>

<li ng-repeat="sel in selState.selections">{{sel.fieldName}}: {{sel.qSelected}}
  <button type="button" class="btn btn-default btn-xs" ng-click="sel.field.clear()" aria-label="Lock">
    <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
  </button>
</li>

Clear all selections in this state.

Parameters

lockedAlso
optional
boolean

Clear locked fields also

Returns

Promise

A promise of a Qlik engine reply

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
var selState = app.selectionState();
selState.clearAll(true);

Lock all selections in this state.

Returns

Promise

A promise of a Qlik engine reply

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
var selState = app.selectionState();
selState.lockAll();

Unlock all selections in this state.

Returns

Promise

A promise of a Qlik engine reply

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
var selState = app.selectionState();
selState.unlockAll();

The Table API allow developers to work with tabular data returned from the Qlik engine without having deeper
knowledge of internal constructs, like for example a hypercube.
From a technical perspective it is a wrapper around HyperCube data from engine.

Notification is sent when data is available. Notification will be triggered after each update. To receive
notification bind a listener on 'OnData' of QTable instance.

Properties

rows
Array<any>

Data rows.

headers
Array<any>

Header information.

totals
Array<any>

Total information for measures.

rowCount
number

Total number of rows for the qHyperCube, including rows not fetched from server.

colCount
number

Total number of columns for the qHyperCube.

// Initialization using the hypercube of the current visualization
var table = qlik.table( this );

var listener = function() {
  var rowCount = table.rowCount;
  var colCount = table.colCount;
  table.OnData.unbind( listener );  //unregister the listener when no longer notification is needed.
};
table.OnData.bind( listener ); //bind the listener
// Example based on using AngularJS.

// Your main script:

if ( !this.$scope.table ) {
  this.$scope.table = qlik.table( this );
}

// In your AngularJS template:

<tr ng-repeat="row in table.rows">
   <td ng-repeat="cell in row.cells"> {{cell.qText}} </td>
</tr>

Export data of the underlying hyperCube in OOXML or CSV format.
Note: The entire hyperCube will be exported, not just the current data-page.

Parameters

options
optional

No description

callback
optional
function

Callback function returning the link to the exported file.

var qTable = qlik.table(this);

var $exportButton = $( document.createElement('button'));
$exportButton.html('Export');
$exportButton.bind('click', function (  ) {
            qTable.exportData({download: true});
        });
$element.append($exportButton);
// Example using AngularJS in a Qlik Sense visualization extension:

// Main script:
...
paint: function ( ) {
        //setup scope.table
        if ( !this.$scope.table ) {
            this.$scope.table = qlik.table( this );
        }
    }
...

// In your template:
<button ng-click="table.exportData({download:true})">Create Excel file</button>

Get column number for a given field name.

Parameters

fld
string

Field name

Returns

number

Column number, starting with zero. Undefined if no column with that name.

var table = qlik.table( this );
var colNumber = table.getColByName('Closed cases');

Get more data for your qHyperCube.

// Example based on using AngularJS in a Qlik Sense visualization extension.

// Main extension script file:
...
paint: function ( ) {
        //setup scope.data
        if ( !this.$scope.data ) {
            this.$scope.data = qlik.table( this );
        }
    }
...

// AngularJS template:
<button ng-if="data.rowcount>data.rows.length" ng-click="data.getMoreData()">More</button>

Wrapper for a theme with helper methods

Introduced in Qlik Sense February 2018

Properties

id
string

Theme id

properties
object

Theme properties tree structure with calculated styling values.
Functions, variables and inheritance have been computed from the original theme json file.

Apply theme to all visualizations on the web page

Returns

Promise<boolean>

Promise of a boolean to indicate success or not

qlik.theme.get('my-theme-id').then(function(qtheme){
  qtheme.apply().then(function(result){
    console.log('theme applied with result: ' + result);
  });
});

Get the value of a style attribute in the theme by searching in the theme's json structure.
The search starts at the specified base path and continue upwards until the value is found.
If possible it will get the attribute's value using the given path.

Parameters

basePath
string

Base path in the theme's json structure to start the search in (specified as a name path separated by dots)

path
string

Expected path for the attribute (specified as a name path separated by dots)

attribute
string

Name of the style attribute

Returns

string

The style value

qlik.theme.get('my-theme-id').then(function(qtheme){
  console.log('Object title font size: ' + qtheme.getStyle('object', 'title.main', 'fontSize'));
});

Creates an instance of the Variable api.

Parameters

app
object

The app object.

qapp
object

The qlik.app wrapper for the app object.

Create variable

Returns

Promise

Promise of a Variable model.

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.variable.create('myvar').then(function(model){
  // do something with myvar
});

Create session variable, a temporary variable that is not persisted and needs to be recreated for each new session.

Introduced in Qlik Sense 2.1

Parameters

qProp

Variable properties.

Returns

Promise

Promise of a Variable model.

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.variable.createSessionVariable({qName : 'myvar', qDefinition: 'Month'}).then(function(model){
  // do something with myvar
});

Get a variable by id.

Introduced in Qlik Sense 2.1

Parameters

qId
string

Variable id.

Returns

Promise

Promise of a Variable model.

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.variable.get('yTgsRI').then(function(model){
  // do something with myvar
});

Get a variable by name.

Introduced in Qlik Sense 2.1

Parameters

qName
string

Variable name.

Returns

Promise

A promise of a Variable model.

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.variable.getByName('myvar').then(function(model){
  // do something with myvar
});

Get variable content.

Parameters

name
string

Variable name.

callback

Callback to receive the content.

Returns

Promise

A promise of a Qlik engine reply.

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.variable.getContent('myvar',function ( reply ) {
  console.log( JSON.stringify( reply ) );
});
deprecated

Set variable content.

Parameters

name
string

Variable name.

content
string

Variable content.

Returns

Promise

A promise of a Qlik engine reply.

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.variable.setContent('myvar','=(1+1)');

Set variable numeric value.

Introduced in Qlik Sense 2.1

Parameters

qName
string

Variable name.

qVal
number

Variable value.

Returns

Promise

A promise of a Qlik engine reply.

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.variable.setNumValue('myvar',5);

Set variable string value.

Introduced in Qlik Sense 2.1

Parameters

qName
string

Variable name.

qVal
string

Variable value.

Returns

Promise

A promise of a Qlik engine reply.

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.variable.setStringValue('myvar','=(1+1)');

Parameters

data

Content of the variable.

qapp
object

The qlik.app object wrapping the app.

The Visualization API allow developers to get visualizations defined in an app and to
create temporary visualizations on the fly.

Introduced in Qlik Sense 2.2

Parameters

qapp

The app referenced in the visualization.

model
object

The visualization model.

Properties

table

Table object for this visualization. Only for visualizations built on a hypercube.

Close visualization

Returns

Promise

No description

Exports data of the underlying hyperCube in OOXML or CSV format.
Note: The entire hyperCube will be exported, not just the current data-page.

Parameters

options

No description

Returns

any

Promise - A promise of the file location URL.

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.visualization.get('xGhjKl').then(function(vis){
  vis.exportData({format:'CSV_T', state: 'A'}).then(function (link) {
    window.open(link);
  });
});

Exports a QVisualization instance to an image.

Parameters

settings

Image export settings.

Returns

any

Promise - A promise of a link to the exported file.

var element = document.getElementById('QV01');
var settings = { imageType: 'png', height: element.offsetHeight, width: element.offsetWidth }

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.visualization.get('xGhjKl').then(function(vis){
  vis.exportImg(settings).then(function (result) {
    console.log('Image download link: ', result);
  });
});

Exports a QVisualization instance to PDF.

Parameters

settings

PDF export settings.

Returns

any

Promise - A promise of a link to the exported file.

var settings = {
  documentSize: "a4",
  aspectRatio: 2,
  orientation: "landscape"
};
var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.visualization.get('xGhjKl').then(function(vis){
  vis.exportPdf(settings).then(function (result) {
    console.log('PDF download link: ', result);
  });
});

Tell the visualization it has been resized and should repaint.

Set visualization options

Parameters

options
object

Options to set. Refer to visualization.create for documentation.

Returns

Promise

A promise of the RPC call's response

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.visualization.get('xGhjKl').then(function(vis){
  vis.setOptions({title:"Now improved"});
});

Show visualization in HTML element

Parameters

element
optional
HTMLElement | string

HTML element or HTML element id.

options
optional

Options to set. Since Qlik Sense 3.0

Returns

object

Scope of the visualization.

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.visualization.get('xGhjKl').then(function(vis){
  vis.show("QV01");
});

Toggles data view.

Creates a DataView object if it doesn't already exist and toggles data view.

Introduced in Qlik Sense June 2018

Disclaimer:
The element that is provided as a parameter to the QVisualization.show method must have
CSS property position set to relative and must not have any padding. If these rules are
not followed, the visualization object may not calculate its width and height correctly
and you may not be able to scroll and navigate after toggling data view.

Proposed action:
Wrap the element with another element. The wrapper can then be styled without any limitations.

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.visualization.get('xGhjKl').then(function(vis){
  vis.show("QV01");
  vis.toggleDataView().then(function(toggled){
    if(toggled){
      this.getElementsByClassName('qv-st')[0].focus();
    }
  }
});