Qlik Community

Integration, Extension & APIs

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

Announcements
Customer & Partners, DEC. 9, 11 AM ET: Qlik Product & Strategy Roadmap Session: Data Analytics REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
dionverbeke
Luminary Alumni
Luminary Alumni

evaluate string in table

Hi,

I would like to dynamically evaluate a string I got from a table in a Qlik Extension.

The story:

1. I retrieve a hypercube

2. In the hypercubematrix one column in a row contains a formula: e.g. =left('Qlik is Great',4)

I would like to have the formula evaluated in the extension at runtime.

3. The result should be a hypercube with the column evaluated: e.g. 'Qlik'

Which api do I need to use?

kr,

Dion

1 Solution

Accepted Solutions
ErikWetterberg

Hi Dion,

This is kind of tricky... You need to call app.evaluate to get this done. But this method is not available in the App API. Instead you need to use enigma.js. Since enigma is autogenerated, all methods defined in the engine API are available. Do note that enigma is flagged as experimental, though.

In an extension you can find enigma at this.backendApi.model.enigmaModel. That is a reference to the GenericObject wrapper, and in this case you need the app wrapper at this.backendApi.model.enigmaModel.app. This means you could do:

this.backendApi.model.enigmaModel.app.evaluate("1+1").then(function(reply){console.log("got reply",reply)});

And you will get a printout like this:

got reply 2

Hope this helps

Erik Wetterberg

View solution in original post

3 Replies
ErikWetterberg

Hi Dion,

This is kind of tricky... You need to call app.evaluate to get this done. But this method is not available in the App API. Instead you need to use enigma.js. Since enigma is autogenerated, all methods defined in the engine API are available. Do note that enigma is flagged as experimental, though.

In an extension you can find enigma at this.backendApi.model.enigmaModel. That is a reference to the GenericObject wrapper, and in this case you need the app wrapper at this.backendApi.model.enigmaModel.app. This means you could do:

this.backendApi.model.enigmaModel.app.evaluate("1+1").then(function(reply){console.log("got reply",reply)});

And you will get a printout like this:

got reply 2

Hope this helps

Erik Wetterberg

View solution in original post

konrad_mattheis
Luminary Alumni
Luminary Alumni

Hi,

you have to be carefull, the enigma is only available in newer versions of qlik sense and the path is changed.

In the newest qlik release this is move from .enigmaModel direct to .model

bye Konrad

ErikWetterberg

What release are you refering to? In September 2017 it is still available at

this.backendApi.model.enigmaModel

Erik