Capability APIs
The Capability APIs are a collection of JavaScript APIs that allows you to easily embed Qlik Sense content into a web page, and interact with data. With just a few lines of code, it is possible to create a visualization that leverages the Qlik Sense visualization library. Consider using the qlik-embed toolkit with the classic/chart or analytics/chart UI for a more modern embedding experience.
External interface to qlik, for mashups and including qlik in foreign web pages.
Properties
- Required
navigation properties
- stringRequired
Used for analysis mode.
- stringRequired
Used for edit mode.
- functionRequired
Get current sheet ID.
Returns- Required
The result of the navigation
properties
- booleanRequired
true if the navigation was successful.
- string
The new sheet ID.
- string
The error code if an error occurred, for example, NOSUCHSHEET or NOCURRENTSHEET.
- string
The error message, for example, 'No current sheet'.
-
-
- functionRequired
Get current mode.
Returns- stringRequired
mode The current mode.
-
- functionRequired
Navigates to a given sheet in the current app. Note that the method will return before the actual navigation takes place.
Parameters- stringRequired
The ID of the sheet to navigate to.
Returns- Required
The result of the navigation operation.
-
- functionRequired
Navigates to a given story in the current app. Note that the method will return before the actual navigation takes place.
Parameters- stringRequired
The ID of the story to navigate to.
Returns- Required
The result of the navigation operation.
properties
- booleanRequired
true if the navigation was successful.
- string
The new story ID.
- string
The error code if an error occurred, for example, NOSUCHSTORY.
- string
The error message, for example, 'No such story'.
-
-
- functionRequired
Checks if a given mode is allowed.
Parameters- stringRequired
The mode to check availability of. Can be either {@link QNavigaton#EDIT} or {@link QNavigaton#ANALYSIS}.
Returns- booleanRequired
If the mode is allowed or not.
-
- functionRequired
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- Required
The result of the navigation operation.
-
- functionRequired
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- Required
The result of the navigation operation.
-
- functionRequired
Set current mode.
Parameters- stringRequired
The mode to change to. Can be either {@link QNavigation#EDIT} or {@link QNavigation#ANALYSIS}.
Returns- Required
The result of the mode change.
properties
- booleanRequired
true if the operation was successful.
- string
The new mode. Can be either {@link QNavigation#EDIT} or {@link QNavigation#ANALYSIS}.
- string
The error code if an error occurred, for example, MODENOTALLOWED.
- string
The error message, for example, 'Mode not allowed'.
-
-
-
- theme QGlobalThemeRequired
theme properties
- apply() functionRequired
Apply a theme to all visualizations on the web page.
Parameters- id stringRequired
ID of theme to apply.
Returns- Promise < boolean >Required
Promise of a boolean to indicate success or not.
-
- get() functionRequired
Get theme as a QTheme object.
Parameters- id stringRequired
Theme id
Returns- Promise < QTheme >Required
A promise of a QTheme object.
-
-
js/qlik
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");
}
Call Qlik repository.
Parameters
- path stringRequired
Path to the Qlik Sense repository. Refer to Qlik Sense repository documentation for the available paths.
- method string
HTTP method.
- body string
Body of the post.
Returns
- Promise < object >Required
A promise of a Qlik repository reply.
callRepository
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 object
Reference to extension object. Since Qlik Sense 1.1
Returns
- Required
An App JavaScript object with app methods.
properties
- addAlternateState() functionRequired
Add an alternate state.
Introduced in Qlik Sense 1.1.
Parameters- qStateName stringRequired
Alternate state name.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- back() functionRequired
Back to prev selection.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- bookmark QBookmarkRequired
bookmark properties
- apply() functionRequired
Apply bookmark.
Parameters- id stringRequired
Bookmark ID.
Returns- PromiseRequired
A promise of a Qlik engine reply. Since Qlik Sense 1.2.
-
- create() functionRequired
Create bookmark based on current selection.
Parameters- title stringRequired
Bookmark title.
- description stringRequired
Bookmark description.
- sheetId string
Bookmark sheet ID. Since Qlik Sense 2.2.
Returns- PromiseRequired
A promise of a Qlik engine reply. Since Qlik Sense 1.2.
-
- remove() functionRequired
Remove bookmark.
Parameters- id stringRequired
Bookmark ID.
Returns- PromiseRequired
A promise of a Qlik engine reply. Since Qlik Sense 1.2.
-
-
- clearAll() functionRequired
Clear all selections.
Parameters- lockedAlso boolean
Also clear locked fields. Since Qlik Sense 2.1
- state string
Alternate state name. Since Qlik Sense 2.1
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- close() functionRequired
Close an app.
Will also close the web socket and clear out client side data.
Introduced in Qlik Sense 1.1
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- createCube() functionRequired
Defines a Qlik Hypercube and registers a callback to receive the data.
Parameters- qHyperCubeDef objectRequired
Cube definition.
- callback function
Callback method. Parameter will contain a qHyperCube.
Returns- PromiseRequired
A promise of an object model.
-
- createGenericObject() functionRequired
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 objectRequired
Generic object definition.
- callback function
Callback method.
Returns- PromiseRequired
A promise of an object model.
-
- createList() functionRequired
Defines a Qlik list of field values and registers a callback to receive the data.
Parameters- qListObjectDef objectRequired
List definition.
- callback function
Callback method. Parameter will contain a qListObject.
Returns- PromiseRequired
A promise of an object model.
-
- createTable() functionRequired
Defines a Qlik Hypercube and creates a table object wrapping the hypercube.
Introduced in Qlik Sense 2.1.
Parameters- dimensions Array< string | NxDimension >Required
Dimensions to use. Should be a field name or a NxDimension structure for each entry.
- measures Array< string | NxMeasure >Required
Measures to use. Should be an expression or a NxMeasure structure for each entry.
- options object
Options to set.
Returns- Required
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.
-
- destroySessionObject() functionRequired
Destroys a Qlik Session object created with createGenericObject or any of createCube, createList, or 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 stringRequired
Session object ID.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- doReload() functionRequired
Reload the app.
Introduced in Qlik Sense 1.1
Parameters- qMode number
Error handling mode: 0 = default mode, 1 = attempt recovery on all errors, 2 = fail on all errors.
- qPartial boolean
Set to true for partial reload.
- qDebug boolean
Set to true if debug breakpoints are honored. Execution of the script will be in debug mode.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- doSave() functionRequired
Save the app.
Introduced in Qlik Sense 1.1.
Parameters- qFileName string
File name of the file to save.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- field() functionRequired
Get a field reference with methods to manipulate field.
Parameters- fld stringRequired
Name of the field.
- statename string
Alternate state name.
Returns- Required
A QField object with methods and properties that can be used to manipulate the field.
properties
- clear() functionRequired
Clears a field selection.
Returns- PromiseRequired
A promise of an engine response.
-
- clearOther() functionRequired
Clears all field selections except this one.
Parameters- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- getData() functionRequired
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 object
Object containing options for the getData call.
options properties
- rows number
Number of rows to fetch. Default 200.
- frequencyMode string
Sets the qFrequencyMode. V=Absolute, P=Percent, R=Relative, N=No frequency. Default V.
-
Returns- Required
The field object.
-
- getMoreData() functionRequired
Get more data for your field. Notification OnData will be triggered when complete.
Introduced in Qlik Sense 2.1
Returns- Required
The field object
-
- lock() functionRequired
Locks a field selection.
Returns- PromiseRequired
A promise of an engine response.
-
- OnData NotificationRequired
OnData notification
OnData properties
- bind() functionRequired
Observe a Notification by sending in an observer function.
Parameters- observer functionRequired
The observer function to handle the notification.
-
- unbind() functionRequired
Stop observing a notification.
Parameters- observer functionRequired
The observer function that now should ignore any future notifications.
-
-
- qStateCounts objectRequired
Object with number of values in different states. Only after getData() call.
Introduced in Qlik Sense 2.1.
- rowCount numberRequired
Number of different values. Only after getData() call.
Introduced in Qlik Sense 2.1.
- rows Array< QFieldValue >Required
Field values. You need to call getData() method to make this available. Since Qlik Sense 2.1.
- select() functionRequired
Select field values using indexes.
Parameters- Array Array< any >Required
of indexes to values to select.
- toggle boolean
If true, toggle selected state.
- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- selectAll() functionRequired
Select all values in field.
Parameters- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- selectAlternative() functionRequired
Select alternative values in field.
Parameters- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- selectExcluded() functionRequired
Select excluded values in field.
Parameters- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- selectMatch() functionRequired
Select matching field values.
Parameters- match stringRequired
Match string.
- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- selectPossible() functionRequired
Select possible values in field.
Parameters- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- selectValues() functionRequired
Select field values.
Parameters- values Array< object >Required
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 boolean
If true, toggle selected state. If false replace the current selection.
- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- toggleSelect() functionRequired
Toggle field selection.
Parameters- match stringRequired
Match string.
- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- unlock() functionRequired
Unlocks a field selection.
Returns- PromiseRequired
A promise of an engine response.
-
-
-
- forward() functionRequired
Forward
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- getAppLayout() functionRequired
Get layout for this app and register a callback to receive the data.
Introduced in Qlik Sense 1.1.
Parameters- callback function
Callback method.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- getAppObjectList() function DeprecatedRequired
Get a list of Qlik application objects and register a callback to receive the data.
Parameters- type string
Type of object. One of: sheet, MasterObject.
- callback function
Callback method.
-
- getFullPropertyTree() functionRequired
Get properties for a Qlik object including children properties.
Parameters- id stringRequired
Object ID.
Returns- PromiseRequired
A promise of an object model.
-
- getList() functionRequired
Get a list of internal Qlik objects and register a callback to receive the data.
Parameters- type stringRequired
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 function
Registers a callback that is executed every time data is returned.
Returns- PromiseRequired
A promise of an object model.
-
- getObject() functionRequired
Inserts a Qlik object into an 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 HTMLElement | string
HTML element. Since version 1.1, it is also possible to define a string of the HTML element ID.
- id stringRequired
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 object
Additional options.
options properties
- noInteraction boolean
Set to true if you want to disable interaction, including selections, in the visualization. Since Qlik Sense 1.1
- noSelections boolean
Set to true if you want to disable selections in the visualization. Since Qlik Sense 3.0
- variant string
used only when getting 'CurrentSelections', for rendering the "dark" variant. Possible values: "dark".
- sheetId string
Sheet id where App Navigation bar exists. (only applies if id='AppNavigationBar') Since Qlik Sense November 2017
- openAppCallback function
Used if you want to handle what happens when user clicks the 'open generated app' button. Otherwise by default generated app is opened in new tab. Callback returns appId and targetSheetId. (only applies if id='AppNavigationBar') Since Qlik Sense November 2017
-
Returns- PromiseRequired
A promise of an object model.
-
- getObjectProperties() functionRequired
Get properties for a Qlik object.
Parameters- id stringRequired
Object ID.
Returns- PromiseRequired
A promise of an object model.
-
- getScript() functionRequired
Gets the data load script of this app.
Introduced in Qlik Sense 4.0
Returns- PromiseRequired
A promise of a qScript object with the load script values.
-
- getSnapshot() functionRequired
Inserts a Qlik snapshot into an 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 HTMLElement | string
HTML element or string with HTML element id.
- id stringRequired
Snapshot ID.
Returns- PromiseRequired
A promise of an object model.
-
- lockAll() functionRequired
Lock all selections.
Parameters- state string
Alternate state name. Since Qlik Sense 2.1.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- off() functionRequired
Remove listener(s) for the app events.
Introduced in Qlik Sense February 2018.
Parameters- eventName string
Name of the event. Can be: error, warning, closed. If no eventName is provided, removes all listeners.
-
- on() functionRequired
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 stringRequired
Name of the event. Can be: error, warning, closed.
- callback functionRequired
Callback method.
-
- removeAlternateState() functionRequired
Remove an alternate state.
Introduced in Qlik Sense 1.1.
Parameters- qStateName stringRequired
Alternate state name
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- searchAssociations() function DeprecatedRequired
Searches for one or more terms in the values of an app.
Introduce in Qlik Sense 1.1.
Parameters- qTerms Array< string >Required
Terms to search for.
- qPage objectRequired
qPage properties
- qOffset numberRequired
Position from the top, starting from 0.
- qCount numberRequired
Number of search results to return.
- qMaxNbrFieldMatches numberRequired
Maximum number of matching values to return per search result.
-
- qOptions object
Search options.
qOptions properties
- qSearchFields Array< string >
List of search fields.
- qContext string
Search context. Can be one of: Cleared, LockedFieldsOnly, CurrentSelections.
-
- callback function
Callback method.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- searchResults() functionRequired
Searches for one or more terms in the values of an app.
Introduced in Qlik Sense 2.2.
Parameters- qTerms Array< string >Required
Terms to search for.
- qPage objectRequired
qPage properties
- qOffset numberRequired
Position from the top, starting from 0.
- qCount numberRequired
Number of search results to return.
- qGroupOptions Array< SearchGroupOptions >
Options of the search groups. If this property is not set, all values are returned.
- qGroupItemOptions Array< SearchGroupItemOptions >
Options of the search group items. If this property is not set, all values are returned.
-
- qOptions object
Search options.
qOptions properties
- qSearchFields Array< string >
List of search fields.
- qContext string
Search context. Can be one of: Cleared, LockedFieldsOnly, CurrentSelections.
-
- callback function
Callback method.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- searchSuggest() functionRequired
Returns search suggestions.
Introduced in Qlik Sense 1.1.
Parameters- qTerms Array< string >Required
Terms to search for.
- qOptions object
Search options.
qOptions properties
- qSearchFields Array< string >
List of search fields.
-
- callback function
Callback method.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- selectAssociations() functionRequired
Make a selection based on searchAssociaton results.
Introduced in Qlik Sense 1.1.
Parameters- qMatchIx number
Index to search result.
- qTerms Array< string >
Values to select.
- qOptions object
Parameter sent to the Qlik engine containing information about the search fields and the search context.
qOptions properties
- qSearchFields Array< string >
List of the search fields. If empty, the search is performed in all fields of the app.
- qContext string
Search context. Can be one of: Cleared, LockedFieldsOnly, CurrentSelections.
-
- qSoftLock boolean
Use the qOptions.qContext parameter instead.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- selectionState() functionRequired
Creates a SelectionState object that encapsulates the selection state.
Introduced in Qlik Sense 2.2.
Parameters- state string
Sets the state.
Returns- Required
A selection state object for the selection state of type QSelectionState.
properties
- stateName stringRequired
State name, '$' for default state.
- selections Array< QFieldSelections >Required
Selections
- backCount numberRequired
Number of back steps available.
- forwardCount numberRequired
Number of forward steps available.
- OnData NotificationRequired
OnData notification.
- clearAll() functionRequired
Clear all selections in this state.
Parameters- lockedAlso boolean
Clear locked fields also.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- lockAll() functionRequired
Lock all selections in this state.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- unlockAll() functionRequired
Unlock all selections in this state.
Returns- PromiseRequired
A promise of a Qlik engine reply
-
-
-
- setScript() functionRequired
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 stringRequired
The script content.
Returns- PromiseRequired
A promise of an empty object or a list of syntax errors depending on the validation result.
-
- theme QAppThemeRequired
theme properties
- get() functionRequired
Get theme as a QTheme object.
Parameters- id string
Theme ID. If no ID is specified, the theme saved for the app is returned.
Returns- Promise < QTheme >Required
A promise of a QTheme object.
-
- getApplied() functionRequired
Get currently applied theme as a QTheme object.
Returns- Promise < QTheme >Required
A promise of a QTheme object.
-
- save() functionRequired
Save a theme ID of an app.
Introduced in Qlik Sense February 2018.
Parameters- id stringRequired
Theme ID.
-
-
- unlockAll() functionRequired
Unlock all selections.
Parameters- state string
Alternate state name. Since Qlik Sense 2.1.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- variable QVariableRequired
variable properties
- create() functionRequired
Create variable.
Returns- PromiseRequired
Promise of a Variable model.
-
- createSessionVariable() functionRequired
Create session variable, which is a temporary variable that is not persisted and needs to be recreated for each new session.
Introduced in Qlik Sense 2.1.
Parameters- qProp objectRequired
Variable properties.
qProp properties
- qInfo objectRequired
qInfo properties
- qId string
Variable ID.
-
- qName stringRequired
Variable name.
- qComment string
Comment regarding the variable.
- qDefinition string
Variable definition.
- qNumberPresentation object
Defines the format of the value.
- qIncludeInBookmark boolean
Include in bookmark flag.
-
Returns- PromiseRequired
Promise of a Variable model.
-
- get() functionRequired
Get a variable by ID.
Introduced in Qlik Sense 2.1.
Parameters- qId stringRequired
Variable ID.
Returns- PromiseRequired
Promise of a Variable model.
-
- getByName() functionRequired
Get a variable by name.
Introduced in Qlik Sense 2.1.
Parameters- qName stringRequired
Variable name.
Returns- PromiseRequired
A promise of a Variable model.
-
- getContent() functionRequired
Get variable content.
Parameters- name stringRequired
Variable name.
- callback getContentCallbackRequired
Callback to receive the content.
callback properties
- getContentCallback() functionRequiredParameters
- data objectRequired
Content of the variable.
data properties
- qContent objectRequired
Value of the variable.
qContent properties
- qString stringRequired
Textual value of the variable.
- qIsNum numberRequired
Numeric value of the variable, if the value can be converted into a number.
-
-
- qapp objectRequired
The qlik.app object wrapping the app.
-
-
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- setContent() function DeprecatedRequired
Set variable content.
Parameters- name stringRequired
Variable name.
- content stringRequired
Variable content.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- setNumValue() functionRequired
Set variable numeric value.
Introduced in Qlik Sense 2.1.
Parameters- qName stringRequired
Variable name.
- qVal numberRequired
Variable value.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- setStringValue() functionRequired
Set variable string value.
Introduced in Qlik Sense 2.1.
Parameters- qName stringRequired
Variable name.
- qVal stringRequired
Variable value.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
-
- visualization QAppVisualizationRequired
visualization properties
- create() functionRequired
Create a new visualization. The visualization will be based on a session object and not persisted in the app.
Parameters- type stringRequired
Visualization type. Built-in visualization like barchart, piechart, linechart, combochart or an extension.
- cols Array< string | NxDimension | NxMeasure >
Column definitions, dimensions and measures. Each entry can be a string, an NxDimension or NxMeasure structure. If the NxDimension or NxMeasure refers to a library dimension or measure, you also might need to add qType measure or dimension.
- options object
Options to set. Refer to documentation for the visualization used for additional options.
options properties
- title string | Expression
Visualization title.
- showTitles boolean
Show title for visualization. Default true.
- subtitle string | Expression
Visualization subtitle.
- footnote string | Expression
Visualization footnote.
-
Returns- Promise < QVisualization >Required
A promise of a {@link QVisualization}.
-
- get() functionRequired
Get an existing visualization.
Introduced in Qlik Sense 2.2.
Parameters- id stringRequired
ID for an existing visualization.
Returns- Promise < QVisualization >Required
A promise of a {@link QVisualization}.
-
-
-
currApp
var app = qlik.currApp(this);
app.clearAll();
Get a list of Qlik apps and register a callback to receive the data. The reply will contain all apps the user has access to.
Parameters
- callback functionRequired
Callback method.
- config object
Additional configuration parameters.
config properties
- host string
Qlik host
- port string | number
Port number as a string or a number.
- prefix string
Qlik virtual proxy, '/' if no proxy
- isSecure boolean
Use SSL
- identity string
Unique identity for the session. If omitted, the session will be shared.
-
getAppList
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);
Get the list of extensions installed in the system. The reply will contain all extensions such as visualizations, mashups, and so on.
Parameters
- callback function
Callback method.
Returns
- PromiseRequired
A promise of a Qlik engine reply.
getExtensionList
qlik.getExtensionList(function(list){
var str = "";
list.forEach(function(value) {
str += value.id + "(" + value.data.type + ") ";
});
console.log(str);
});
Open a connection with a Web Socket to engine for global methods.
Parameters
- config object
Additional configuration parameters.
config properties
- host string
Qlik host
- port string | number
Port number as a string or a number.
- prefix string
Qlik virtual proxy, '/' if no proxy
- isSecure boolean
Use SSL
- identity string
Unique identity for the session. If omitted, the session will be shared.
-
Returns
- Required
A global JavaScript object with global methods.
properties
- cancelReload() functionRequired
Cancel reload.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- getAppList() functionRequired
Get app list.
Parameters- callback functionRequired
callback method.
-
- getAuthenticatedUser() functionRequired
Retrieves information about the authenticated user. Note: This method is only applicable to Qlik Sense Enterprise on Windows. For Qlik Sense Enterprise SaaS, use {@link https://qlik.dev/apis/rest/users#%23%2Fentries%2Fusers%2Fme-get|User API}
Parameters- callback function
callback method.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- getProductVersion() function DeprecatedRequired
Get Product Version.
Introduced in Qlik Sense 1.2.
Parameters- callback function
callback method.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- getProgress() functionRequired
Get Progress.
Introduced in Qlik Sense 2.1.
Parameters- qRequestId numberRequired
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 function
callback method.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- getQTProduct() functionRequired
Get QT Product.
Parameters- callback function
callback method.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- isPersonalMode() functionRequired
Get isPersonalMode.
Parameters- callback function
callback method.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- off() functionRequired
Remove listener(s) for the global events.
Introduced in Qlik Sense February 2018.
Parameters- eventName string
Name of the event. Can be: error, warning, closed. Removes all listeners if no eventName is provided.
-
- on() functionRequired
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 stringRequired
Name of the event. Can be: error, warning, closed.
- callback functionRequired
Callback method.
-
-
getGlobal
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
- PromiseRequired
A promise of a list of themes including the ID and the metadata name.
getThemeList
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 string
Name of the event. If no eventName is provided, removes all listeners.
off
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 stringRequired
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 functionRequired
Callback method.
on
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 stringRequired
The app ID.
- config object
Additional configuration parameters.
config properties
- host string
Qlik host
- port string | number
Port number as a string or a number.
- prefix string
Qlik virtual proxy, '/' if no proxy
- isSecure boolean
Use SSL
- openWithoutData boolean
Open app without loading data. Since Qlik Sense 1.1
- identity string
Unique identity for the session. If omitted, the session will be shared.
-
Returns
- Required
An App JavaScript object with app methods.
openApp
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 indicate that the rendering is complete. Full documentation available on: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise.
Parameters
- executor functionRequired
The executing function with two parameters: resolve and reject.
Promise
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 stringRequired
Set the ID of the visualization extension.
- impl objectRequired
Set the extension implementation.
- metadata object
Extension metadata, same format as QEXT file.
registerExtension
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 string
Object ID. Optional: if no ID, resize event will be sent to all objects.
resize
//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 object
Additional configuration parameters.
config properties
- host string
Qlik host
- port string | number
Port number as a string or a number.
- prefix string
Qlik virtual proxy, '/' if no proxy.
- isSecure boolean
Use SSL.
- identity string
Unique identity for the session. If omitted, the session will be shared.
-
Returns
- Required
An app JavaScript object with app methods.
sessionApp
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 stringRequired
App ID of the app to base the session app upon.
- config object
Additional configuration parameters.
config properties
- host string
Qlik host
- port string | number
Port number as a string or a number.
- prefix string
Qlik virtual proxy, '/' if no proxy.
- isSecure boolean
Use SSL.
- identity string
Unique identity for the session. If omitted, the session will be shared.
-
Returns
- Required
An app JavaScript object with app methods.
sessionAppFromApp
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 stringRequired
Type of device. One of: auto, touch, desktop.
setDeviceType
qlik.setDeviceType('desktop');
setLanguage
qlik.setLanguage("es");
Parameters
- onError functionRequired
Error handling function.
- onWarning function
Warning handling function. Since Qlik Sense 2.1.
setOnError
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 objectRequired
Extension or angular scope for the extension.
- path string
Path to the hypercube.
Returns
- Required
table - A QTable object that holds data and options for the table.
properties
- rows Array< QRow >Required
Data rows.
- headers Array< QHeader >Required
Header information.
- totals Array< QMeasureCell >Required
Total information for measures.
- rowCount numberRequired
Total number of rows for the qHyperCube, including rows not fetched from server.
- colCount numberRequired
Total number of columns for the qHyperCube.
- exportData() functionRequired
Export data of the underlying hyperCube in OOXML or CSV format.
Note: The entire hyperCube will be exported, not just the current data-page. On Cloud this functionality will go through the Reports API, which limits the available options
Parameters- options object
options properties
- format string
Data format. Can be one of: OOXML (open XML, default), CSV_C (comma separated CSV), CSV_T (tab separated CSV)
- filename string
This parameter is optional and only used in desktop. Sets the name of the exported file when downloaded. Example: filename(guid).xlsx.
- state string
Can be: A: all values, P: possible values (default)
- download boolean
Automatically start download of file (with window.open), defaults to false.
-
- callback function
Callback function returning the link to the exported file.
-
- getColByName() functionRequired
Get column number for a given field name.
Parameters- fld stringRequired
Field name.
Returns- numberRequired
Column number, starting with zero. Undefined if no column with that name.
-
- getMoreData() functionRequired
Get more data for your qHyperCube.
-
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 functionRequired
The observer function to handle the notification.
Stop observing a notification.
Parameters
- observer functionRequired
The observer function that now should ignore any future notifications.
Describes the size, in millimeters (mm), of a 2D object.
Properties
- height numberRequired
Object height in millimeters (mm).
- width numberRequired
Object width in millimeters (mm).
Describes the size, in pixels, of a 2D object.
Properties
- height numberRequired
Object height in pixels.
- width numberRequired
Object width in pixels.
Properties
- bookmark QBookmarkRequired
bookmark properties
- apply() functionRequired
Apply bookmark.
Parameters- id stringRequired
Bookmark ID.
Returns- PromiseRequired
A promise of a Qlik engine reply. Since Qlik Sense 1.2.
-
- create() functionRequired
Create bookmark based on current selection.
Parameters- title stringRequired
Bookmark title.
- description stringRequired
Bookmark description.
- sheetId string
Bookmark sheet ID. Since Qlik Sense 2.2.
Returns- PromiseRequired
A promise of a Qlik engine reply. Since Qlik Sense 1.2.
-
- remove() functionRequired
Remove bookmark.
Parameters- id stringRequired
Bookmark ID.
Returns- PromiseRequired
A promise of a Qlik engine reply. Since Qlik Sense 1.2.
-
-
- theme QAppThemeRequired
theme properties
- get() functionRequired
Get theme as a QTheme object.
Parameters- id string
Theme ID. If no ID is specified, the theme saved for the app is returned.
Returns- Promise < QTheme >Required
A promise of a QTheme object.
-
- getApplied() functionRequired
Get currently applied theme as a QTheme object.
Returns- Promise < QTheme >Required
A promise of a QTheme object.
-
- save() functionRequired
Save a theme ID of an app.
Introduced in Qlik Sense February 2018.
Parameters- id stringRequired
Theme ID.
-
-
- variable QVariableRequired
variable properties
- create() functionRequired
Create variable.
Returns- PromiseRequired
Promise of a Variable model.
-
- createSessionVariable() functionRequired
Create session variable, which is a temporary variable that is not persisted and needs to be recreated for each new session.
Introduced in Qlik Sense 2.1.
Parameters- qProp objectRequired
Variable properties.
qProp properties
- qInfo objectRequired
qInfo properties
- qId string
Variable ID.
-
- qName stringRequired
Variable name.
- qComment string
Comment regarding the variable.
- qDefinition string
Variable definition.
- qNumberPresentation object
Defines the format of the value.
- qIncludeInBookmark boolean
Include in bookmark flag.
-
Returns- PromiseRequired
Promise of a Variable model.
-
- get() functionRequired
Get a variable by ID.
Introduced in Qlik Sense 2.1.
Parameters- qId stringRequired
Variable ID.
Returns- PromiseRequired
Promise of a Variable model.
-
- getByName() functionRequired
Get a variable by name.
Introduced in Qlik Sense 2.1.
Parameters- qName stringRequired
Variable name.
Returns- PromiseRequired
A promise of a Variable model.
-
- getContent() functionRequired
Get variable content.
Parameters- name stringRequired
Variable name.
- callback getContentCallbackRequired
Callback to receive the content.
callback properties
- getContentCallback() functionRequiredParameters
- data objectRequired
Content of the variable.
data properties
- qContent objectRequired
Value of the variable.
qContent properties
- qString stringRequired
Textual value of the variable.
- qIsNum numberRequired
Numeric value of the variable, if the value can be converted into a number.
-
-
- qapp objectRequired
The qlik.app object wrapping the app.
-
-
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- setContent() function DeprecatedRequired
Set variable content.
Parameters- name stringRequired
Variable name.
- content stringRequired
Variable content.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- setNumValue() functionRequired
Set variable numeric value.
Introduced in Qlik Sense 2.1.
Parameters- qName stringRequired
Variable name.
- qVal numberRequired
Variable value.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- setStringValue() functionRequired
Set variable string value.
Introduced in Qlik Sense 2.1.
Parameters- qName stringRequired
Variable name.
- qVal stringRequired
Variable value.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
-
- visualization QAppVisualizationRequired
visualization properties
- create() functionRequired
Create a new visualization. The visualization will be based on a session object and not persisted in the app.
Parameters- type stringRequired
Visualization type. Built-in visualization like barchart, piechart, linechart, combochart or an extension.
- cols Array< string | NxDimension | NxMeasure >
Column definitions, dimensions and measures. Each entry can be a string, an NxDimension or NxMeasure structure. If the NxDimension or NxMeasure refers to a library dimension or measure, you also might need to add qType measure or dimension.
- options object
Options to set. Refer to documentation for the visualization used for additional options.
options properties
- title string | Expression
Visualization title.
- showTitles boolean
Show title for visualization. Default true.
- subtitle string | Expression
Visualization subtitle.
- footnote string | Expression
Visualization footnote.
-
Returns- Promise < QVisualization >Required
A promise of a {@link QVisualization}.
-
- get() functionRequired
Get an existing visualization.
Introduced in Qlik Sense 2.2.
Parameters- id stringRequired
ID for an existing visualization.
Returns- Promise < QVisualization >Required
A promise of a {@link QVisualization}.
-
-
Add an alternate state.
Introduced in Qlik Sense 1.1.
Parameters
- qStateName stringRequired
Alternate state name.
Returns
- PromiseRequired
A promise of a Qlik engine reply.
addAlternateState
app.addAlternateState("X");
Back to prev selection.
Returns
- PromiseRequired
A promise of a Qlik engine reply.
back
var app = qlik.openApp('2abac31e-3b46-4b78-8bxf-c5cea1d2514d');
app.back();
Clear all selections.
Parameters
- lockedAlso boolean
Also clear locked fields. Since Qlik Sense 2.1
- state string
Alternate state name. Since Qlik Sense 2.1
Returns
- PromiseRequired
A promise of a Qlik engine reply.
clearAll
var app = qlik.openApp('2abac31e-3b46-4b78-8bxf-c5cea1d2514d');
app.clearAll();
Close an app.
Will also close the web socket and clear out client side data.
Introduced in Qlik Sense 1.1
Returns
- PromiseRequired
A promise of a Qlik engine reply.
close
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 objectRequired
Cube definition.
- callback function
Callback method. Parameter will contain a qHyperCube.
Returns
- PromiseRequired
A promise of an object model.
createCube
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 objectRequired
Generic object definition.
- callback function
Callback method.
Returns
- PromiseRequired
A promise of an object model.
createGenericObject
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 objectRequired
List definition.
- callback function
Callback method. Parameter will contain a qListObject.
Returns
- PromiseRequired
A promise of an object model.
createList
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< string | NxDimension >Required
Dimensions to use. Should be a field name or a NxDimension structure for each entry.
- measures Array< string | NxMeasure >Required
Measures to use. Should be an expression or a NxMeasure structure for each entry.
- options object
Options to set.
Returns
- Required
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.
properties
- rows Array< QRow >Required
Data rows.
- headers Array< QHeader >Required
Header information.
- totals Array< QMeasureCell >Required
Total information for measures.
- rowCount numberRequired
Total number of rows for the qHyperCube, including rows not fetched from server.
- colCount numberRequired
Total number of columns for the qHyperCube.
- exportData() functionRequired
Export data of the underlying hyperCube in OOXML or CSV format.
Note: The entire hyperCube will be exported, not just the current data-page. On Cloud this functionality will go through the Reports API, which limits the available options
Parameters- options object
options properties
- format string
Data format. Can be one of: OOXML (open XML, default), CSV_C (comma separated CSV), CSV_T (tab separated CSV)
- filename string
This parameter is optional and only used in desktop. Sets the name of the exported file when downloaded. Example: filename(guid).xlsx.
- state string
Can be: A: all values, P: possible values (default)
- download boolean
Automatically start download of file (with window.open), defaults to false.
-
- callback function
Callback function returning the link to the exported file.
-
- getColByName() functionRequired
Get column number for a given field name.
Parameters- fld stringRequired
Field name.
Returns- numberRequired
Column number, starting with zero. Undefined if no column with that name.
-
- getMoreData() functionRequired
Get more data for your qHyperCube.
-
createTable
var users = app.createTable(["FirstName", "LastName"], ["Count(Case Id)"],{rows:200});
Destroys a Qlik Session object created with createGenericObject or any of createCube, createList, or 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 stringRequired
Session object ID.
Returns
- PromiseRequired
A promise of a Qlik engine reply.
destroySessionObject
app.destroySessionObject( 'xcVtY');
app.destroySessionObject(reply.qInfo.qId);
Reload the app.
Introduced in Qlik Sense 1.1
Parameters
- qMode number
Error handling mode: 0 = default mode, 1 = attempt recovery on all errors, 2 = fail on all errors.
- qPartial boolean
Set to true for partial reload.
- qDebug boolean
Set to true if debug breakpoints are honored. Execution of the script will be in debug mode.
Returns
- PromiseRequired
A promise of a Qlik engine reply.
doReload
app.doReload();
Save the app.
Introduced in Qlik Sense 1.1.
Parameters
- qFileName string
File name of the file to save.
Returns
- PromiseRequired
A promise of a Qlik engine reply.
doSave
app.doReload().then(function(){
app.doSave();
});
Get a field reference with methods to manipulate field.
Parameters
- fld stringRequired
Name of the field.
- statename string
Alternate state name.
Returns
- Required
A QField object with methods and properties that can be used to manipulate the field.
properties
- clear() functionRequired
Clears a field selection.
Returns- PromiseRequired
A promise of an engine response.
-
- clearOther() functionRequired
Clears all field selections except this one.
Parameters- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- getData() functionRequired
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 object
Object containing options for the getData call.
options properties
- rows number
Number of rows to fetch. Default 200.
- frequencyMode string
Sets the qFrequencyMode. V=Absolute, P=Percent, R=Relative, N=No frequency. Default V.
-
Returns- Required
The field object.
-
- getMoreData() functionRequired
Get more data for your field. Notification OnData will be triggered when complete.
Introduced in Qlik Sense 2.1
Returns- Required
The field object
-
- lock() functionRequired
Locks a field selection.
Returns- PromiseRequired
A promise of an engine response.
-
- OnData NotificationRequired
OnData notification
OnData properties
- bind() functionRequired
Observe a Notification by sending in an observer function.
Parameters- observer functionRequired
The observer function to handle the notification.
-
- unbind() functionRequired
Stop observing a notification.
Parameters- observer functionRequired
The observer function that now should ignore any future notifications.
-
-
- qStateCounts objectRequired
Object with number of values in different states. Only after getData() call.
Introduced in Qlik Sense 2.1.
- rowCount numberRequired
Number of different values. Only after getData() call.
Introduced in Qlik Sense 2.1.
- rows Array< QFieldValue >Required
Field values. You need to call getData() method to make this available. Since Qlik Sense 2.1.
- select() functionRequired
Select field values using indexes.
Parameters- Array Array< any >Required
of indexes to values to select.
- toggle boolean
If true, toggle selected state.
- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- selectAll() functionRequired
Select all values in field.
Parameters- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- selectAlternative() functionRequired
Select alternative values in field.
Parameters- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- selectExcluded() functionRequired
Select excluded values in field.
Parameters- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- selectMatch() functionRequired
Select matching field values.
Parameters- match stringRequired
Match string.
- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- selectPossible() functionRequired
Select possible values in field.
Parameters- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- selectValues() functionRequired
Select field values.
Parameters- values Array< object >Required
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 boolean
If true, toggle selected state. If false replace the current selection.
- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- toggleSelect() functionRequired
Toggle field selection.
Parameters- match stringRequired
Match string.
- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- unlock() functionRequired
Unlocks a field selection.
Returns- PromiseRequired
A promise of an engine response.
-
-
forward
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 function
Callback method.
Returns
- PromiseRequired
A promise of a Qlik engine reply.
getAppLayout
app.getAppLayout(function(layout){
console.log(layout.qTitle);
});
Get a list of Qlik application objects and register a callback to receive the data.
Parameters
- type string
Type of object. One of: sheet, MasterObject.
- callback function
Callback method.
getAppObjectList
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 stringRequired
Object ID.
Returns
- PromiseRequired
A promise of an object model.
getFullPropertyTree
app.getFullPropertyTree(value.qInfo.qId).then(function(model){
console.log(model.propertyTree.qChildren.length + ' children');
});
Get a list of internal Qlik objects and register a callback to receive the data.
Parameters
- type stringRequired
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 function
Registers a callback that is executed every time data is returned.
Returns
- PromiseRequired
A promise of an object model.
getList
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 an 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 HTMLElement | string
HTML element. Since version 1.1, it is also possible to define a string of the HTML element ID.
- id stringRequired
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 object
Additional options.
options properties
- noInteraction boolean
Set to true if you want to disable interaction, including selections, in the visualization. Since Qlik Sense 1.1
- noSelections boolean
Set to true if you want to disable selections in the visualization. Since Qlik Sense 3.0
- variant string
used only when getting 'CurrentSelections', for rendering the "dark" variant. Possible values: "dark".
- sheetId string
Sheet id where App Navigation bar exists. (only applies if id='AppNavigationBar') Since Qlik Sense November 2017
- openAppCallback function
Used if you want to handle what happens when user clicks the 'open generated app' button. Otherwise by default generated app is opened in new tab. Callback returns appId and targetSheetId. (only applies if id='AppNavigationBar') Since Qlik Sense November 2017
-
Returns
- PromiseRequired
A promise of an object model.
getObject
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 stringRequired
Object ID.
Returns
- PromiseRequired
A promise of an object model.
getObjectProperties
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
- PromiseRequired
A promise of a qScript object with the load script values.
getScript
var app = qlik.openApp( "MY_APP_ID");
app.getScript().then( function(script){
console.log(script);
});
Inserts a Qlik snapshot into an 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 HTMLElement | string
HTML element or string with HTML element id.
- id stringRequired
Snapshot ID.
Returns
- PromiseRequired
A promise of an object model.
getSnapshot
app.getSnapshot(document.getElementById("SNAPSHOT"), "uPyZavD");
Lock all selections.
Parameters
- state string
Alternate state name. Since Qlik Sense 2.1.
Returns
- PromiseRequired
A promise of a Qlik engine reply.
lockAll
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 string
Name of the event. Can be: error, warning, closed. If no eventName is provided, removes all listeners.
off
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 stringRequired
Name of the event. Can be: error, warning, closed.
- callback functionRequired
Callback method.
on
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 stringRequired
Alternate state name
Returns
- PromiseRequired
A promise of a Qlik engine reply.
removeAlternateState
app.removeAlternateState("X");
Searches for one or more terms in the values of an app.
Introduce in Qlik Sense 1.1.
Parameters
- qTerms Array< string >Required
Terms to search for.
- qPage objectRequired
qPage properties
- qOffset numberRequired
Position from the top, starting from 0.
- qCount numberRequired
Number of search results to return.
- qMaxNbrFieldMatches numberRequired
Maximum number of matching values to return per search result.
-
- qOptions object
Search options.
qOptions properties
- qSearchFields Array< string >
List of search fields.
- qContext string
Search context. Can be one of: Cleared, LockedFieldsOnly, CurrentSelections.
-
- callback function
Callback method.
Returns
- PromiseRequired
A promise of a Qlik engine reply.
searchAssociations
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< string >Required
Terms to search for.
- qPage objectRequired
qPage properties
- qOffset numberRequired
Position from the top, starting from 0.
- qCount numberRequired
Number of search results to return.
- qGroupOptions Array< SearchGroupOptions >
Options of the search groups. If this property is not set, all values are returned.
- qGroupItemOptions Array< SearchGroupItemOptions >
Options of the search group items. If this property is not set, all values are returned.
-
- qOptions object
Search options.
qOptions properties
- qSearchFields Array< string >
List of search fields.
- qContext string
Search context. Can be one of: Cleared, LockedFieldsOnly, CurrentSelections.
-
- callback function
Callback method.
Returns
- PromiseRequired
A promise of a Qlik engine reply.
searchResults
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< string >Required
Terms to search for.
- qOptions object
Search options.
qOptions properties
- qSearchFields Array< string >
List of search fields.
-
- callback function
Callback method.
Returns
- PromiseRequired
A promise of a Qlik engine reply.
searchSuggest
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 number
Index to search result.
- qTerms Array< string >
Values to select.
- qOptions object
Parameter sent to the Qlik engine containing information about the search fields and the search context.
qOptions properties
- qSearchFields Array< string >
List of the search fields. If empty, the search is performed in all fields of the app.
- qContext string
Search context. Can be one of: Cleared, LockedFieldsOnly, CurrentSelections.
-
- qSoftLock boolean
Use the qOptions.qContext parameter instead.
Returns
- PromiseRequired
A promise of a Qlik engine reply.
selectAssociations
app.selectAssociations( 0, ["May","Mar"] );
Creates a SelectionState object that encapsulates the selection state.
Introduced in Qlik Sense 2.2.
Parameters
- state string
Sets the state.
Returns
- Required
A selection state object for the selection state of type QSelectionState.
properties
- stateName stringRequired
State name, '$' for default state.
- selections Array< QFieldSelections >Required
Selections
- backCount numberRequired
Number of back steps available.
- forwardCount numberRequired
Number of forward steps available.
- OnData NotificationRequired
OnData notification.
- clearAll() functionRequired
Clear all selections in this state.
Parameters- lockedAlso boolean
Clear locked fields also.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- lockAll() functionRequired
Lock all selections in this state.
Returns- PromiseRequired
A promise of a Qlik engine reply.
-
- unlockAll() functionRequired
Unlock all selections in this state.
Returns- PromiseRequired
A promise of a Qlik engine reply
-
-
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 stringRequired
The script content.
Returns
- PromiseRequired
A promise of an empty object or a list of syntax errors depending on the validation result.
setScript
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 string
Alternate state name. Since Qlik Sense 2.1.
Returns
- PromiseRequired
A promise of a Qlik engine reply.
unlockAll
var app = qlik.openApp('2abac31e-3b46-4b78-8bxf-c5cea1d2514d');
app.unlockAll();
Get theme as a QTheme object.
Parameters
- id string
Theme ID. If no ID is specified, the theme saved for the app is returned.
Returns
- Promise < QTheme >Required
A promise of a QTheme object.
get
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 >Required
A promise of a QTheme object.
getApplied
app.theme.getApplied().then(function(qtheme){
console.log('Current theme background color: ' + qtheme.properties.backgroundColor);
});
Save a theme ID of an app.
Introduced in Qlik Sense February 2018.
Parameters
- id stringRequired
Theme ID.
save
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 stringRequired
Visualization type. Built-in visualization like barchart, piechart, linechart, combochart or an extension.
- cols Array< string | NxDimension | NxMeasure >
Column definitions, dimensions and measures. Each entry can be a string, an NxDimension or NxMeasure structure. If the NxDimension or NxMeasure refers to a library dimension or measure, you also might need to add qType measure or dimension.
- options object
Options to set. Refer to documentation for the visualization used for additional options.
options properties
- title string | Expression
Visualization title.
- showTitles boolean
Show title for visualization. Default true.
- subtitle string | Expression
Visualization subtitle.
- footnote string | Expression
Visualization footnote.
-
Returns
- Promise < QVisualization >Required
A promise of a {@link QVisualization}.
create
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.
Introduced in Qlik Sense 2.2.
Parameters
- id stringRequired
ID for an existing visualization.
Returns
- Promise < QVisualization >Required
A promise of a {@link QVisualization}.
get
var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.visualization.get('xGhjKl').then(function(vis){
vis.show("QV01");
});
Apply bookmark.
Parameters
- id stringRequired
Bookmark ID.
Returns
- PromiseRequired
A promise of a Qlik engine reply. Since Qlik Sense 1.2.
apply
var app = qlik.openApp("c31e2aba-3b46-4b13-8b87-c5c2514dea1d");
app.bookmark.apply("pPvpTN");
Create bookmark based on current selection.
Parameters
- title stringRequired
Bookmark title.
- description stringRequired
Bookmark description.
- sheetId string
Bookmark sheet ID. Since Qlik Sense 2.2.
Returns
- PromiseRequired
A promise of a Qlik engine reply. Since Qlik Sense 1.2.
create
var app = qlik.openApp("c31e2aba-3b46-4b13-8b87-c5c2514dea1d");
app.bookmark.create("Test","Test bookmark","fmcJkH");
Remove bookmark.
Parameters
- id stringRequired
Bookmark ID.
Returns
- PromiseRequired
A promise of a Qlik engine reply. Since Qlik Sense 1.2.
remove
var app = qlik.openApp("c31e2aba-3b46-4b13-8b87-c5c2514dea1d");
app.bookmark.remove("pPvpTN");
Wrapper around a HyperCube dimension cell.
Properties
- qText stringRequired
Cell value formatted as set up in properties.
- qElemNumber numberRequired
Cell value index.
- qState stringRequired
Cell state.
- qNum number
Cell numeric value, if cell is numeric.
select
<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 contains methods for field level commands.
Properties
- OnData NotificationRequired
OnData notification
OnData properties
- bind() functionRequired
Observe a Notification by sending in an observer function.
Parameters- observer functionRequired
The observer function to handle the notification.
-
- unbind() functionRequired
Stop observing a notification.
Parameters- observer functionRequired
The observer function that now should ignore any future notifications.
-
-
- qStateCounts objectRequired
Object with number of values in different states. Only after getData() call.
Introduced in Qlik Sense 2.1.
- rowCount numberRequired
Number of different values. Only after getData() call.
Introduced in Qlik Sense 2.1.
- rows Array< QFieldValue >Required
Field values. You need to call getData() method to make this available. Since Qlik Sense 2.1.
Clears a field selection.
Returns
- PromiseRequired
A promise of an engine response.
clear
var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.field('LastName').clear();
Clears all field selections except this one.
Parameters
- softlock boolean
If true, locked selections can be overridden.
Returns
- PromiseRequired
A promise of an engine response.
clearOther
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 object
Object containing options for the getData call.
options properties
- rows number
Number of rows to fetch. Default 200.
- frequencyMode string
Sets the qFrequencyMode. V=Absolute, P=Percent, R=Relative, N=No frequency. Default V.
-
Returns
- Required
The field object.
getData
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
- Required
The field object
getMoreData
<button ng-if="fieldMonth.rowCount>fieldMonth.rows.length" ng-click="fieldMonth.getMoreData()">More</button>
Locks a field selection.
Returns
- PromiseRequired
A promise of an engine response.
lock
var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.field('LastName').lock();
Select field values using indexes.
Parameters
- Array Array< any >Required
of indexes to values to select.
- toggle boolean
If true, toggle selected state.
- softlock boolean
If true, locked selections can be overridden.
Returns
- PromiseRequired
A promise of an engine response.
select
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 boolean
If true, locked selections can be overridden.
Returns
- PromiseRequired
A promise of an engine response.
selectAll
var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.field('LastName').selectAll();
Select alternative values in field.
Parameters
- softlock boolean
If true, locked selections can be overridden.
Returns
- PromiseRequired
A promise of an engine response.
selectAlternative
var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.field('LastName').selectAlternative();
Select excluded values in field.
Parameters
- softlock boolean
If true, locked selections can be overridden.
Returns
- PromiseRequired
A promise of an engine response.
selectExcluded
var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.field('LastName').selectExcluded();
Select matching field values.
Parameters
- match stringRequired
Match string.
- softlock boolean
If true, locked selections can be overridden.
Returns
- PromiseRequired
A promise of an engine response.
selectMatch
var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.field('LastName').selectMatch('A', true);
Select possible values in field.
Parameters
- softlock boolean
If true, locked selections can be overridden.
Returns
- PromiseRequired
A promise of an engine response.
selectPossible
var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.field('LastName').selectPossible();
Select field values.
Parameters
- values Array< object >Required
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 boolean
If true, toggle selected state. If false replace the current selection.
- softlock boolean
If true, locked selections can be overridden.
Returns
- PromiseRequired
A promise of an engine response.
selectValues
app.field("Month").selectValues([5], true, true);
app.field(fld).selectValues(["Wetterberg"], true, true);
Toggle field selection.
Parameters
- match stringRequired
Match string.
- softlock boolean
If true, locked selections can be overridden.
Returns
- PromiseRequired
A promise of an engine response.
toggleSelect
var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.field('LastName').toggleSelect('A', true);
Unlocks a field selection.
Returns
- PromiseRequired
A promise of an engine response.
unlock
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 stringRequired
The field name.
- qSortIndex numberRequired
Sort index, starting from 0.
- field QFieldRequired
Reference to the field.
field properties
- clear() functionRequired
Clears a field selection.
Returns- PromiseRequired
A promise of an engine response.
-
- clearOther() functionRequired
Clears all field selections except this one.
Parameters- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- getData() functionRequired
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 object
Object containing options for the getData call.
options properties
- rows number
Number of rows to fetch. Default 200.
- frequencyMode string
Sets the qFrequencyMode. V=Absolute, P=Percent, R=Relative, N=No frequency. Default V.
-
Returns- Required
The field object.
-
- getMoreData() functionRequired
Get more data for your field. Notification OnData will be triggered when complete.
Introduced in Qlik Sense 2.1
Returns- Required
The field object
-
- lock() functionRequired
Locks a field selection.
Returns- PromiseRequired
A promise of an engine response.
-
- OnData NotificationRequired
OnData notification
OnData properties
- bind() functionRequired
Observe a Notification by sending in an observer function.
Parameters- observer functionRequired
The observer function to handle the notification.
-
- unbind() functionRequired
Stop observing a notification.
Parameters- observer functionRequired
The observer function that now should ignore any future notifications.
-
-
- qStateCounts objectRequired
Object with number of values in different states. Only after getData() call.
Introduced in Qlik Sense 2.1.
- rowCount numberRequired
Number of different values. Only after getData() call.
Introduced in Qlik Sense 2.1.
- rows Array< QFieldValue >Required
Field values. You need to call getData() method to make this available. Since Qlik Sense 2.1.
- select() functionRequired
Select field values using indexes.
Parameters- Array Array< any >Required
of indexes to values to select.
- toggle boolean
If true, toggle selected state.
- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- selectAll() functionRequired
Select all values in field.
Parameters- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- selectAlternative() functionRequired
Select alternative values in field.
Parameters- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- selectExcluded() functionRequired
Select excluded values in field.
Parameters- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- selectMatch() functionRequired
Select matching field values.
Parameters- match stringRequired
Match string.
- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- selectPossible() functionRequired
Select possible values in field.
Parameters- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- selectValues() functionRequired
Select field values.
Parameters- values Array< object >Required
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 boolean
If true, toggle selected state. If false replace the current selection.
- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- toggleSelect() functionRequired
Toggle field selection.
Parameters- match stringRequired
Match string.
- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- unlock() functionRequired
Unlocks a field selection.
Returns- PromiseRequired
A promise of an engine response.
-
-
- locked booleanRequired
Is field locked?
- isNumeric booleanRequired
Is field numeric?
- totalCount numberRequired
Total number of values in field.
- selectedCount numberRequired
Number of selected values.
- qSelectionThreshold numberRequired
Number of values that will be listed.
- qStateCounts objectRequired
Object with number of values in different states.
- qSelected stringRequired
Concatenated string of selected values if # of values are less than the threshold or string of format "7 of 123".
- selectedValues Array< number >Required
Array with a maximum of qSelectionThreshold values that are selected. For each value the text plus the selection mode (NORMAL/AND/NOT).
- notSelectedValues Array< number >Required
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 stringRequired
Cell value formatted as set up in properties.
- qElemNumber numberRequired
Cell value index.
- qState stringRequired
Cell state.
- qNum number
Cell numeric value, if cell is numeric.
- qFrequency string
Frequency, if calculated by engine.
Select field value.
Introduced in Qlik Sense 2.1.
Parameters
- toggle boolean
If true, toggle selected state.
- softlock boolean
If true, locked selections can be overridden.
Returns
- PromiseRequired
A promise.
select
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
- PromiseRequired
A promise of a Qlik engine reply.
cancelReload
var global = qlik.getGlobal(config);
global.cancelReload();
Get app list.
Parameters
- callback functionRequired
callback method.
getAppList
qlik.getGlobal(config).getAppList(function(list){
var str = "";
$.each(list, function(key, value) {
str += value.qDocName + '('+ value.qDocId + ')';
});
console.log(str);
});
Retrieves information about the authenticated user. Note: This method is only applicable to Qlik Sense Enterprise on Windows. For Qlik Sense Enterprise SaaS, use {@link https://qlik.dev/apis/rest/users#%23%2Fentries%2Fusers%2Fme-get|User API}
Parameters
- callback function
callback method.
Returns
- PromiseRequired
A promise of a Qlik engine reply.
getAuthenticatedUser
var global = qlik.getGlobal(config);
global.getAuthenticatedUser(function(reply){
console.log('User:'+reply.qReturn);
});
Get Product Version.
Introduced in Qlik Sense 1.2.
Parameters
- callback function
callback method.
Returns
- PromiseRequired
A promise of a Qlik engine reply.
getProductVersion
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 numberRequired
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 function
callback method.
Returns
- PromiseRequired
A promise of a Qlik engine reply.
getProgress
var global = qlik.getGlobal(config);
global.getProgress();
Get QT Product.
Parameters
- callback function
callback method.
Returns
- PromiseRequired
A promise of a Qlik engine reply.
getQTProduct
var global = qlik.getGlobal(config);
global.getQTProduct(function(reply){
console.log('QT Product:'+reply.qReturn);
});
Get isPersonalMode.
Parameters
- callback function
callback method.
Returns
- PromiseRequired
A promise of a Qlik engine reply.
isPersonalMode
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 string
Name of the event. Can be: error, warning, closed. Removes all listeners if no eventName is provided.
off
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 stringRequired
Name of the event. Can be: error, warning, closed.
- callback functionRequired
Callback method.
on
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 stringRequired
ID of theme to apply.
Returns
- Promise < boolean >Required
Promise of a boolean to indicate success or not.
apply
qlik.theme.apply('my-theme-id').then(function(result){
console.log('theme applied with result: ' + result);
});
Get theme as a QTheme object.
Parameters
- id stringRequired
Theme id
Returns
- Promise < QTheme >Required
A promise of a QTheme object.
get
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 stringRequired
Column title.
- qSortIndicator stringRequired
A: ascending, D:Descending
- isOrderedBy booleanRequired
Is this the first column for sort?
- qReverseSort booleanRequired
Is sort order currently reversed for this column?
- col numberRequired
Column number.
- qCardinal number
Number of different values. Only for dimensions.
- qStateCounts object
Object with number of values in different states. Only for dimensions.
- field QField
Field object with methods to manipulate the underlying field. Only used for dimensions.
field properties
- clear() functionRequired
Clears a field selection.
Returns- PromiseRequired
A promise of an engine response.
-
- clearOther() functionRequired
Clears all field selections except this one.
Parameters- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- getData() functionRequired
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 object
Object containing options for the getData call.
options properties
- rows number
Number of rows to fetch. Default 200.
- frequencyMode string
Sets the qFrequencyMode. V=Absolute, P=Percent, R=Relative, N=No frequency. Default V.
-
Returns- Required
The field object.
-
- getMoreData() functionRequired
Get more data for your field. Notification OnData will be triggered when complete.
Introduced in Qlik Sense 2.1
Returns- Required
The field object
-
- lock() functionRequired
Locks a field selection.
Returns- PromiseRequired
A promise of an engine response.
-
- OnData NotificationRequired
OnData notification
OnData properties
- bind() functionRequired
Observe a Notification by sending in an observer function.
Parameters- observer functionRequired
The observer function to handle the notification.
-
- unbind() functionRequired
Stop observing a notification.
Parameters- observer functionRequired
The observer function that now should ignore any future notifications.
-
-
- qStateCounts objectRequired
Object with number of values in different states. Only after getData() call.
Introduced in Qlik Sense 2.1.
- rowCount numberRequired
Number of different values. Only after getData() call.
Introduced in Qlik Sense 2.1.
- rows Array< QFieldValue >Required
Field values. You need to call getData() method to make this available. Since Qlik Sense 2.1.
- select() functionRequired
Select field values using indexes.
Parameters- Array Array< any >Required
of indexes to values to select.
- toggle boolean
If true, toggle selected state.
- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- selectAll() functionRequired
Select all values in field.
Parameters- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- selectAlternative() functionRequired
Select alternative values in field.
Parameters- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- selectExcluded() functionRequired
Select excluded values in field.
Parameters- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- selectMatch() functionRequired
Select matching field values.
Parameters- match stringRequired
Match string.
- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- selectPossible() functionRequired
Select possible values in field.
Parameters- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- selectValues() functionRequired
Select field values.
Parameters- values Array< object >Required
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 boolean
If true, toggle selected state. If false replace the current selection.
- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- toggleSelect() functionRequired
Toggle field selection.
Parameters- match stringRequired
Match string.
- softlock boolean
If true, locked selections can be overridden.
Returns- PromiseRequired
A promise of an engine response.
-
- unlock() functionRequired
Unlocks a field selection.
Returns- PromiseRequired
A promise of an engine response.
-
-
- qMin number
Minimum value. Only for measures.
- qMax number
Maximum value. Only for measures.
- errorCode number
Error code for this column. Only if column has an error. Since Qlik Sense 2.2.
- errorMessage string
Error message for this column. Only if column has an error. Since Qlik Sense 2.2.
QHeader
<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>
Select a range in this measure.
Parameters
- min numberRequired
Sets the minimum value of the range.
- max numberRequired
Sets the maximum value of the range.
- inclMin boolean
Set to true to include minimum value.
- inclMax boolean
Set to true to include maximum value.
Returns
- PromiseRequired
selectRange
this.table.headers[1].selectRange( this.minval, this.maxval );
Wrapper around a HyperCube measure cell.
Properties
- qText stringRequired
Cell value formatted as set up in properties.
- qNum 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.
getPercent
<div class="bar" style="width:{{row.measures[0].getPercent()}}%">
getPercentOfMax
<div class="bar" style="width:{{row.measures[0].getPercentOfMax()}}%">
Properties
- stringRequired
Used for analysis mode.
- stringRequired
Used for edit mode.
Get current sheet ID.
Returns
- Required
The result of the navigation
properties
- booleanRequired
true if the navigation was successful.
- string
The new sheet ID.
- string
The error code if an error occurred, for example, NOSUCHSHEET or NOCURRENTSHEET.
- string
The error message, for example, 'No current sheet'.
-
getCurrentSheetId
getMode
Navigates to a given sheet in the current app. Note that the method will return before the actual navigation takes place.
Parameters
- stringRequired
The ID of the sheet to navigate to.
Returns
- Required
The result of the navigation operation.
gotoSheet
Navigates to a given story in the current app. Note that the method will return before the actual navigation takes place.
Parameters
- stringRequired
The ID of the story to navigate to.
Returns
- Required
The result of the navigation operation.
properties
- booleanRequired
true if the navigation was successful.
- string
The new story ID.
- string
The error code if an error occurred, for example, NOSUCHSTORY.
- string
The error message, for example, 'No such story'.
-
gotoStory
Checks if a given mode is allowed.
Parameters
- stringRequired
The mode to check availability of. Can be either {@link QNavigaton#EDIT} or {@link QNavigaton#ANALYSIS}.
Returns
- booleanRequired
If the mode is allowed or not.
isModeAllowed
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
- Required
The result of the navigation operation.
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
- Required
The result of the navigation operation.
prevSheet
Set current mode.
Parameters
- stringRequired
The mode to change to. Can be either {@link QNavigation#EDIT} or {@link QNavigation#ANALYSIS}.
Returns
- Required
The result of the mode change.
properties
- booleanRequired
true if the operation was successful.
- string
The new mode. Can be either {@link QNavigation#EDIT} or {@link QNavigation#ANALYSIS}.
- string
The error code if an error occurred, for example, MODENOTALLOWED.
- string
The error message, for example, 'Mode not allowed'.
-
setMode
Return value from mode related navigation methods.
Properties
- booleanRequired
true if the operation was successful.
- string
The new mode. Can be either {@link QNavigation#EDIT} or {@link QNavigation#ANALYSIS}.
- string
The error code if an error occurred, for example, MODENOTALLOWED.
- string
The error message, for example, 'Mode not allowed'.
Return value from sheet navigation methods.
Properties
- booleanRequired
true if the navigation was successful.
- string
The new sheet ID.
- string
The error code if an error occurred, for example, NOSUCHSHEET or NOCURRENTSHEET.
- string
The error message, for example, 'No current sheet'.
Return value from story navigation methods.
Properties
- booleanRequired
true if the navigation was successful.
- string
The new story ID.
- string
The error code if an error occurred, for example, NOSUCHSTORY.
- string
The error message, for example, 'No such story'.
Wrapper around a HyperCube data row.
Properties
- dimensions Array< QDimensionCell >Required
Dimension cells.
- measures Array< QMeasureCell >Required
Measure cells.
- cells Array< any >Required
All cells, in the order defined in properties.
QRow
<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 stringRequired
State name, '$' for default state.
- selections Array< QFieldSelections >Required
Selections
- backCount numberRequired
Number of back steps available.
- forwardCount numberRequired
Number of forward steps available.
- OnData NotificationRequired
OnData notification.
OnData properties
- bind() functionRequired
Observe a Notification by sending in an observer function.
Parameters- observer functionRequired
The observer function to handle the notification.
-
- unbind() functionRequired
Stop observing a notification.
Parameters- observer functionRequired
The observer function that now should ignore any future notifications.
-
-
QSelectionState
// 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 boolean
Clear locked fields also.
Returns
- PromiseRequired
A promise of a Qlik engine reply.
clearAll
var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
var selState = app.selectionState();
selState.clearAll(true);
Lock all selections in this state.
Returns
- PromiseRequired
A promise of a Qlik engine reply.
lockAll
var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
var selState = app.selectionState();
selState.lockAll();
Unlock all selections in this state.
Returns
- PromiseRequired
A promise of a Qlik engine reply
unlockAll
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< QRow >Required
Data rows.
- headers Array< QHeader >Required
Header information.
- totals Array< QMeasureCell >Required
Total information for measures.
- rowCount numberRequired
Total number of rows for the qHyperCube, including rows not fetched from server.
- colCount numberRequired
Total number of columns for the qHyperCube.
QTable
// 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. On Cloud this functionality will go through the Reports API, which limits the available options
Parameters
- options object
options properties
- format string
Data format. Can be one of: OOXML (open XML, default), CSV_C (comma separated CSV), CSV_T (tab separated CSV)
- filename string
This parameter is optional and only used in desktop. Sets the name of the exported file when downloaded. Example: filename(guid).xlsx.
- state string
Can be: A: all values, P: possible values (default)
- download boolean
Automatically start download of file (with window.open), defaults to false.
-
- callback function
Callback function returning the link to the exported file.
exportData
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 stringRequired
Field name.
Returns
- numberRequired
Column number, starting with zero. Undefined if no column with that name.
getColByName
var table = qlik.table( this );
var colNumber = table.getColByName('Closed cases');
getMoreData
// 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 stringRequired
Theme id
- properties objectRequired
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 >Required
Promise of a boolean to indicate success or not.
apply
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 continues upwards until the value is found. If possible, it will get the attribute's value using the given path.
Parameters
- basePath stringRequired
Base path in the theme's json structure to start the search in (specified as a name path separated by dots).
- path stringRequired
Expected path for the attribute (specified as a name path separated by dots).
- attribute stringRequired
Name of the style attribute.
Returns
- stringRequired
The style value.
getStyle
qlik.theme.get('my-theme-id').then(function(qtheme){
console.log('Object title font size: ' + qtheme.getStyle('object', 'title.main', 'fontSize'));
});
create
var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.variable.create('myvar').then(function(model){
// do something with myvar
});
Create session variable, which is a temporary variable that is not persisted and needs to be recreated for each new session.
Introduced in Qlik Sense 2.1.
Parameters
- qProp objectRequired
Variable properties.
qProp properties
- qInfo objectRequired
qInfo properties
- qId string
Variable ID.
-
- qName stringRequired
Variable name.
- qComment string
Comment regarding the variable.
- qDefinition string
Variable definition.
- qNumberPresentation object
Defines the format of the value.
- qIncludeInBookmark boolean
Include in bookmark flag.
-
Returns
- PromiseRequired
Promise of a Variable model.
createSessionVariable
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 stringRequired
Variable ID.
Returns
- PromiseRequired
Promise of a Variable model.
get
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 stringRequired
Variable name.
Returns
- PromiseRequired
A promise of a Variable model.
getByName
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 stringRequired
Variable name.
- callback getContentCallbackRequired
Callback to receive the content.
callback properties
- getContentCallback() functionRequiredParameters
- data objectRequired
Content of the variable.
data properties
- qContent objectRequired
Value of the variable.
qContent properties
- qString stringRequired
Textual value of the variable.
- qIsNum numberRequired
Numeric value of the variable, if the value can be converted into a number.
-
-
- qapp objectRequired
The qlik.app object wrapping the app.
-
-
Returns
- PromiseRequired
A promise of a Qlik engine reply.
getContent
var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.variable.getContent('myvar',function ( reply ) {
console.log( JSON.stringify( reply ) );
});
Set variable content.
Parameters
- name stringRequired
Variable name.
- content stringRequired
Variable content.
Returns
- PromiseRequired
A promise of a Qlik engine reply.
setContent
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 stringRequired
Variable name.
- qVal numberRequired
Variable value.
Returns
- PromiseRequired
A promise of a Qlik engine reply.
setNumValue
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 stringRequired
Variable name.
- qVal stringRequired
Variable value.
Returns
- PromiseRequired
A promise of a Qlik engine reply.
setStringValue
var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
app.variable.setStringValue('myvar','=(1+1)');
The Visualization API allows developers to get visualizations defined in an app and to create temporary visualizations on the fly.
Introduced in Qlik Sense 2.2.
Properties
- table QTableRequired
Table object for this visualization. Only for visualizations built on a hypercube.
table properties
- rows Array< QRow >Required
Data rows.
- headers Array< QHeader >Required
Header information.
- totals Array< QMeasureCell >Required
Total information for measures.
- rowCount numberRequired
Total number of rows for the qHyperCube, including rows not fetched from server.
- colCount numberRequired
Total number of columns for the qHyperCube.
- exportData() functionRequired
Export data of the underlying hyperCube in OOXML or CSV format.
Note: The entire hyperCube will be exported, not just the current data-page. On Cloud this functionality will go through the Reports API, which limits the available options
Parameters- options object
options properties
- format string
Data format. Can be one of: OOXML (open XML, default), CSV_C (comma separated CSV), CSV_T (tab separated CSV)
- filename string
This parameter is optional and only used in desktop. Sets the name of the exported file when downloaded. Example: filename(guid).xlsx.
- state string
Can be: A: all values, P: possible values (default)
- download boolean
Automatically start download of file (with window.open), defaults to false.
-
- callback function
Callback function returning the link to the exported file.
-
- getColByName() functionRequired
Get column number for a given field name.
Parameters- fld stringRequired
Field name.
Returns- numberRequired
Column number, starting with zero. Undefined if no column with that name.
-
- getMoreData() functionRequired
Get more data for your qHyperCube.
-
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 objectRequired
options properties
- format string
Data format. Can be one of "OOXML" (open XML, default), "CSV_C" (comma separated CSV) or "CSV_T" (tab separated CSV)
- state string
Can be either "A", for all values, or "P", for possible values. "P" is the default.
-
Returns
- anyRequired
Promise
- A promise of the file location URL.
exportData
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 objectRequired
Image export settings.
settings properties
- height number | stringRequired
Output height in pixels.
- width number | stringRequired
Output width in pixels.
- format stringRequired
The image type the visualization should be exported to. Can be PNG or JPG. Default is PNG.
- download boolean
automatically start download of file. default: false
-
Returns
- anyRequired
Promise
- A promise of a link to the exported file.
exportImg
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 objectRequired
PDF export settings.
settings properties
- documentSize string | ObjectMetricSizeRequired
Size of the output PDF. Accepts a string with one of the following document formats: "A3", "A4", "A5", "A6", "A7", "Letter" or an object with custom size.
- orientation stringRequired
Can be "portrait" or "landscape" (ignored if documentSize is an object) default "landscape".
- aspectRatio numberRequired
Aspect ratio: 0 = as specified in objectSize, 2 = fit to page.
- objectSize ObjectPixelSizeRequired
Exported object height and width in pixels. Required when aspectRatio is 0.
objectSize properties
- height numberRequired
Object height in pixels.
- width numberRequired
Object width in pixels.
-
- download boolean
automatically start download of file. default: false
-
Returns
- anyRequired
Promise
- A promise of a link to the exported file.
exportPdf
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);
});
});
Set visualization options.
Parameters
- options objectRequired
Options to set. Refer to visualization.create for documentation.
Returns
- PromiseRequired
A promise of the RPC call's response.
setOptions
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 HTMLElement | string
HTML element or HTML element ID.
- options object
Options to set. Since Qlik Sense 3.0.
options properties
- noInteraction boolean
true if you want to disable all interaction in the visualization.
- noSelections boolean
true if you want to disable selections in the visualization.
-
Returns
- objectRequired
Scope of the visualization.
show
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.
toggleDataView
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();
}
}
});
Parameters
- data objectRequired
Content of the variable.
data properties
- qContent objectRequired
Value of the variable.
qContent properties
- qString stringRequired
Textual value of the variable.
- qIsNum numberRequired
Numeric value of the variable, if the value can be converted into a number.
-
-
- qapp objectRequired
The qlik.app object wrapping the app.