setScript method

STABLE.
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

Introduced Qlik Sense June 2017

Parameters

Name Type Description
script 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");
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");
app.setScript(script).then( function(result){
  console.log(result);
});

Did this information help you?

Can you tell us why it did not help you and how we can improve it?

Thanks for helping us improve!