mindspank / qsocks

A lightweight promise wrapper around the Qlik Sense Engine API
MIT License
51 stars 23 forks source link

createSessionObject to retrieve a DimensionList #29

Closed alexbjorlig closed 8 years ago

alexbjorlig commented 8 years ago

Hi Alexander.

I'm trying to retrieve a list of all master dimensions. Currently I have the following: `.then(function (app) {

return app.createSessionObject({
    "qInfo": {
        "qType": "DimensionList"
    },
    "qDimensionListDef": {
        "qType": "dimension",
        "qData": {
            "title": "/title",
            "tags": "/tags",
            "grouping": "/qDim/qGrouping",
            "info": "/qDimInfos"
        }
    }
}).then(function (GenericObject) {
    return GenericObject.GetLayout().then(function (dimension_list) { 
        console.log(dimension_list);
    })
});

})`

But I am not sure how to do this?

alexbjorlig commented 8 years ago

I got it now.. ` .then(function (app) {

var obj = {
    "qInfo": {
        "qType": "DimensionList"
    },
    "qDimensionListDef": {
        "qType": "dimension",
        "qData": {
            "title": "/title",
            "tags": "/tags",
            "grouping": "/qDim/qGrouping",
            "info": "/qDimInfos"
        }
    }
};

app.createSessionObject(obj).then(function (list) {
    list.getLayout().then(function (layout) {
        console.log(layout.qInfo)
    });
});

}); `

mindspank commented 8 years ago

Ah correct, while the Engine API documentation on the Qlik help site will list methods in pascal case qsock will utilize lower camelcase to be more js-centric.

Qlik Help Docs: GetLayout() Qsocks: getLayout()