mindspank / qsocks

A lightweight promise wrapper around the Qlik Sense Engine API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Destroy Measure

alexbjorlig opened this issue · comments

I am trying to delete a measure.
I have obtained the id of the measure using the Engine API Explorer.
When I run the code I get this error...
{ code: -32602
parameter: 'JSON type error',
message: 'Invalid method parameter(s)' }

Code:
`
var qsocks = require('qsocks');// Is used to communicate with Qlik Sense

qsocks.Connect().then(function (global) {
// from the global handle we can invoke methods from the global class
return global.openDoc('Ledelsesinfo.qvf')
})
.then(function (app) {

console.log("Connected..");

app.destroyMeasure(
    {
        qInfo: {
            qId: "LPKkx"
        }
    })
    .catch(function (error) {
    console.log(error)
})
    .then(function () {
    return app.doSave();
});

})
.catch(function (error) {
console.log(error)
});

`

Amazing! I actually read the documentation and tried to do just app.destroyMeasure('LPKkx') with no success (there must have been something else wrong) --> but now it works like a charm.