Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Is there a way in the Capabilities API to evaluate a custom expression in an app, and just get the result of that expression back?
Or is enigma.js with JWT's needed for this?
Like, if I want to get the value back from an expression like "=sum(num_of_something)", without having that in an existing KPI object, and not create a KPI object on the fly.
Loooong time since I worked with the client but I think you can do something like:
app = await window.engineModuleGlobal.getCurrentApp()
result = await app.evaluateEx({"qExpression": "1+1"});
{
"qvalue": {
"qText": "2",
"qIsNumeric": true,
"qNumber": 2
}
}
It should be possible with enigma.js at least (or Qlik CLI)
https://qlik.dev/apis/json-rpc/qix/doc#%23%2Fentries%2FDoc%2Fentries%2FEvaluateEx
Yes, but that will require either a JWT or setting up an API key or ticketing - right?
I would like to do it in the context of Capabilities API, where the users is already authenticated.
Loooong time since I worked with the client but I think you can do something like:
app = await window.engineModuleGlobal.getCurrentApp()
result = await app.evaluateEx({"qExpression": "1+1"});
{
"qvalue": {
"qText": "2",
"qIsNumeric": true,
"qNumber": 2
}
}
Hi @StefanBackstrand , you can do this with Capability APIs method createGeneric object, see this link for an example.
Regarding Engine APIs (used by enigma.js), you can access them from Capability APIs all the time. You just need to access the enigmaModel object present in app objected return by openApp method.
You have to first wait for enigmaModel promise, then acces enigmaModel and use any of the Engine APIs method. Below an example using createSessionObject method.
await qlikApp.model.waitForOpen.promise;
const appProsObj = await qlikApp.model.enigmaModel.createSessionObject(objectDef);