How to access system data and variables in an extension
Sometimes when you are building a Qlik Sense extension you need to get access to system data. This is espescially true if you are trying to build something a bit more generic. Perhaps you need a list of fields, or dimensions, or measures. Or you need to work with variables.
If you are new to Qlik Sense development you might look in the API documentation for methods to get the data you need. Don’t do that!! Qlik Sense extension model is based on the idea that you use one Generic Object, described in the extensions initialProperties, and modified by the user in the property panel, and possibly programmatically (but that’s really advanced). So while using the API methods to get additonal data is the approach to use in mashups or Web apps that access Qlik data, you should avoid using them in a masup.
Instead you should add the data you need to the underlying Generic Object, by adding them to your initialProperties structure. Here is a little table of what you can use:
Do not use API call
Instead add to initialProperties
List of fields
List of measures
List of dimensions
List of variables
qStringExpression or qValueExpression
I have made an example extension that does this for you. The initialProperties in it looks like this: