2 Replies Latest reply: Jul 12, 2017 8:39 AM by Konrad Mattheis RSS

    evaluate string in table

    dion verbeke

      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

        • Re: evaluate string in table
          Erik Wetterberg

          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