Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
TiagoPedro90
Partner - Contributor
Partner - Contributor

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?

 

Best

Tiago

Labels (3)
2 Replies
Aiham_Azmeh
Employee
Employee

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

TiagoPedro90
Partner - Contributor
Partner - Contributor
Author

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: }
_maxListeners:undefined
addListener:function (type, listener) { … }
emit:function (type) { … }
genericType:undefined
handle:2
id:undefined
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) { … }
type:"Field"
__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?

 

Best

Tiago