This blog is about fetching the objects of an app using Qlik APP API. This will be helpful if you want to build a dashboard that shows insights on the complexity of the app itself apart from the complexity of the data model.
These will also help in some advanced mashups that helps users to create some dynamic content.
The example in full is available (getMasterItems – GitHub). This example uses the default app, Consumer Sales.qvf, that comes with the Qliksense desktop. And hence it can be directly tested with no modifications.
A single method is used to retrieve details of measures, dimensions, variables, fields etc. But you can use it appropriately to fetch only the details that is needed. In this example, the master items – Dimensions and Measures are fetched.
Its part of the App API : app.getList();
app.getList(listType, function(reply){
var str="";
$.each(reply["q"+listType].qItems, function(key, value) {
str=str+ "<br>" + value.qData.title + " - " + value.qInfo.qId;
});
$('#QV01').html(str);
});
}
The entire list of objects that can be fetched is given here
While, this gives necessary information about the objects, it does not give enough information about the variable, measure or dimension definition.
In order to fetch, the variable definition you can use app.variable.getContent() function. This fetches the variable definition.
console.log(model);
});
In order to fetch the same details of measure or dimension, you could use Engine API functions: GetLayout
In order to fetch meta information about the App, you can use getAppLayout() function of App API
app.getAppLayout(function(layout){
console.log("Layout")
console.log(layout);
$('#QV01').html(JSON.stringify(layout))
});
}
Leave a Reply