halyard.js is a JavaScript library that simplifies the Qlik Sense data load experience as it abstracts away the need to write a load script.
The functionality in halyard.js is divided into two parts where the first one is halyard.js
itself. It generates the load script, as well as the connections needed. The second part is halyard-enigma-mixin.js
that extends the functionality of enigma.js
to bring your halyard representation into the QIX engine.
let halyard = new Halyard();
Adds custom set statements to the beginning of the script. Typically used to configure time/data/currency settings.
defaultSetStatements
is an object where the key becomes the variable name in the set statement, and the value becomes the variable value.
halyard.setDefaultSetStatements({DateFormat: 'MM-DD-YYYY'});
// getScript() will return SET DateFormat='MM-DD-YYYY';
Any entered default set statement will be replaced by default if this method is called a second time with defaultSetStatement
containing already defined keys.
If preservePreviouslyEnteredValues
is set to true, then previously entered set statements will be preserved even if the setDefaultSetStatements
method is called multiple times.
Adds a table to the data model representation. More info about Halyard.Table.
The addTable
method accepts an explicit table definition:
let table = new Halyard.Table('c:\\data\\file.csv');
halyard.addTable(table);
addTable
returns a Halyard.Table instance
You can also add a table by providing the table definition:
halyard.addTable('c:\\data\\file.csv', 'TableName');
addTable
returns a Halyard.Table instance
Adds any object that responds to getScript()
. An example of a how to use this method to extend with custom functionality extending-functionality.js in examples
Retrieves the script representation of the items added to halyard.js. The script returned can be set to QIX Engine using the setScript(script)
method.
halyard.getScript();
Returns an array of QIX connections that needs to be created before the doReload()
method is called. To create connections, use the createConnection(connection)
method.
halyard.getQixConnections();
Returns the item that generated the script block at the specified character position from the getScript()
call. The main usage for this method is to identify what item that causes a reload failure.
const syntaxErrorAtCharacterPosition = 32;
halyard.getItemThatGeneratedScriptAt(syntaxErrorAtCharacterPosition);
Creates a session app according to the specification setup in the Halyard
instance provided. This method will return the session app.
Creates an app with the specified appName
and Halyard
instance. This method will return the an app object.
Updates an existing app named existingAppName
with new data from the Halyard
instance. If createIfMissing
is set to true, an app is created if it does not already exist.
Note that this method replaces any script that already exist in the app.
See extending-functionality.js in examples for more info about how to extend with new functionality.
Please follow the instructions in CONTRIBUTING.md.
More examples can be found in examples or in the examples/ folder