Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
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.

7 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi,

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

Regards,

Jagan.

ErikWetterberg

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

});

Not applicable
Author

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.

ErikWetterberg

Try this instead:

app.createGenericObject({

qMeasureListDef : {

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

                    }

}, function(reply){

//take care of result

});

Not applicable
Author

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

ErikWetterberg

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

});

Not applicable
Author

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.