Skip to main content Skip to complementary content

setScript method

Information noteSTABLE.

This API is reliable and breaking changes are unlikely.

qlik.app.setScript(script)

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

Version history

Version history
Version state Details
Introduced Qlik Sense June 2017

Parameters

script

Type: String

The script content.

Returns

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

Examples

This example loads data from an Excel spreadsheet.
var script = "LOAD Sales FROM [lib://data/sample.xlsx];";
var app = qlik.openApp("2abac31e-3b46-4b78-8bxf-c5cea1d2514d", config);
app.setScript(script).then( function(result){
  console.log(result);
});
This example loads the data, from a shortened version of the prepared test script, inline.
var script = "Load Chr(RecNo()+Ord('A')-1) as Alpha, RecNo() as Num autogenerate 26;"
var app = qlik.openApp("2abac31e-3b46-4b78-8bxf-c5cea1d2514d", config);
app.setScript(script).then( function(result){
  console.log(result);
});

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!