The qlik-sse
module
const q = require('qlik-sse');
A namespace for easy access to types, all types in SSE.proto are accessible from this namespace:
console.log(q.sse.FunctionType.AGGREGATION); // 1
Creates a new Server instance.
const q = require('qlik-sse');
const server = q.server({
identifier: 'abc',
allowScript: true,
});
fn
<function (Request)>config
<Object>functionType
<[FunctionType]> Type of functionreturnType
<[DataType]> Type of data this function is expected to returnparams
<Array<Object>>name
<string>dataType
: <[DataType]>
tableDescription
<[TableDescription]> Description of the returned table when function is called from load script using theextension
clause.
Register a function which can be called from an expression.
const fn = (request) => {/* do stuff */};
server.addFunction(fn, {
functionType: q.sse.FunctionType.TENSOR,
returnType: q.sse.DataType.NUMERIC,
params: [{
name: 'first',
dataType: q.sse.DataType.NUMERIC
}]
})
Starts the server.
request.on('data', (bundle) => {/* deal with bundle*/})
bundle
<[BundledRows]>
Writes data back to Qlik Engine.
request.on('data', (bundle) => {
const returnBundle = {/* */};
request.write(returnBundle);
});