Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Sense - Get 'Master items' details programatically

Hi,

is it possible to get information about the master items dimensions, measures and visualizations programatically (using JavaScript API)?

In particular, I'm interested in getting the information that's shown within Sense, namely the Name, description and tags and so on.

Many thanks,

Shane.

Tags (1)
7 Replies
MVP
MVP

Re: Sense - Get 'Master items' details programatically

Hi,

I think right now it is not possible, may be in future releases this is possible.

Regards,

Jagan.

erik_wetterberg
Valued Contributor III

Re: Sense - Get 'Master items' details programatically

You can use the getList method in the mashups API to get Dimensions and Measures. Something like:

app.getList("DimensionList", function(reply){

     //do something

});

app.getList("MeasureList", function(reply){

     //do something

});

Erik Wetterberg
https://extendingqlik.upper88.com/
Not applicable

Re: Sense - Get 'Master items' details programatically

when I make those calls, I don't get any meaningful data returned. 

For example, when I call getList with a first parameter of "DimensionList", I see the following when I log the 'reply' to the console:

qDimensionList.png

qItems is an empty array, which is not what I was expecting, as I do have dimensions in the app.

erik_wetterberg
Valued Contributor III

Re: Sense - Get 'Master items' details programatically

Try this instead:

app.createGenericObject({

qMeasureListDef : {

                        qType: "measure", qData: { title: "/title", tags: "/tags" }

                    }

}, function(reply){

//take care of result

});

Erik Wetterberg
https://extendingqlik.upper88.com/
Not applicable

Re: Sense - Get 'Master items' details programatically

that works - thanks very much. 

I had a look at the help for createGenericObject, and it's not clear how I could have arrived at the code you posted.  Is there anywhere with more information?  How, for example (if at all possible), could I also retrieve the description of the measure?  To get the dimensions, would I substitute references of 'measure' with 'dimension'?

It also doesn't seem an intuitive method name, createGenericObject, since I'm not creating anything, I'm merely getting information.

Thanks

erik_wetterberg
Valued Contributor III

Re: Sense - Get 'Master items' details programatically

Actually you are creating something: a GenericObject that resides only in memory, aka a session object.

The getList function is a helper function that actually calls createGenericObject with some parameters. Seems like they are incomplete in 0.96 (I guess that you are using that version). The good news is that they are fixed in 1.0.

You are right, we need more documentation on this anyhow.

To get the dimensions, use this:

app.createGenericObject({

qDimensionListDef : {

                        qType: "dimension", qData: { title: "/title", tags: "/tags", grouping: "/qDim/qGrouping", info: "/qDimInfos" }

}, function(reply){

//take care of result

});

Erik Wetterberg
https://extendingqlik.upper88.com/
Not applicable

Re: Sense - Get 'Master items' details programatically

Thanks for the clarification Erik.

You're right - I am using 0.96 - any idea when 1.0 will become available?

Thanks for the dimensions code.

Community Browser