API
October 13, 2019 ยท View on GitHub
q
The qlik-sse module
const q = require('qlik-sse');
q.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
q.server(options)
Creates a new Server instance.
const q = require('qlik-sse');
const server = q.server({
identifier: 'abc',
allowScript: true,
});
Server
server.addFunction(fn, config)
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 theextensionclause.
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
}]
})
server.start(options)
Starts the server.
Request
request.on(event, fn)
request.on('data', (bundle) => {/* deal with bundle*/})
request.write(bundle)
bundle<[BundledRows]>
Writes data back to Qlik Engine.
request.on('data', (bundle) => {
const returnBundle = {/* */};
request.write(returnBundle);
});