Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcement: Certain actions are currently causing a Page Not Found error. This is a known issue and we are working with the platform vendor to investigate and resolve it.

enigma.js getField method not working properly

Hey everyone,

I'm creating a bot service that communicates with the Qlik Engine API. The createSessionObject works fine and I can ask for measures constrained by dimensions, but I've been trying to call methods that select fields that seem to be not working. Namely, the "clearAll" method or the "getField".

When I call the "clearAll" from an opened app the fields that are selected aren't cleared, and with the "getField" I cannot perform selects over it.

The app is being properly opened as I can run the "createSessionObject" properly, but the other mentioned methods just don't work properly.

Has anyone ran over this same issue?




2 Replies

Re: enigma.js getField method not working properly

Hi Tiago,

Maybe the field name is wrong or similar - when using getField and the Engine does not find that field, you should get (If I remember right) - the promise

  qHandle: null,
  qType: null

And even though the filed is not found, with enigmsjs, you will still get all the field methods ('clearAll', etc...)

You should check also your websocket communication with the app

-- https://core.qlik.com/services/qix-engine/apis/qix/doc/#getfield


Re: enigma.js getField method not working properly

Hi Aaz,

Thanks for the response.

The field is correct, it works when I try over the Engine API Explorer, and I've checked it over and over again.

I can use the 'createSessionObject' successfully and I call the "getField" method the following way:

let qField = await this.qApp.getField('MONTH');

Which returns the following object:

_events:Object {closed: }
addListener:function (type, listener) { … }
emit:function (type) { … }
listeners:function (type) { … }
on:function (type, listener) { … }
once:function (type, listener) { … }
removeAllListeners:function (type) { … }
removeListener:function (type, listener) { … }
session:Session {apis: ApiCache, config: Object, intercept: Intercept, …}
setMaxListeners:function (n) { … }
__proto__:Object {getCardinal: , getAndM

then I can call any field method, but with no success, i.e.:

let result = await qField.selectAlternative();

The 'result' variable evaluates to 'true', but nothing happens on the Qlik Sense sheet.


Also, when I call the 'ClearAll' method on the Doc class, nothing happens and the dimensions I have applied on the Qlik Sense sheet aren't cleared. However, it does work on the Engine API Explorer.

Am I missing something regarding how to select/clear fields?