Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Not applicable

How do I load Data in my Extension without using an expression?

Hi all Qlik Sense Developers,

I'm Pretty new to the world of extensions and javascript, so I hope my question will be clear:

I want to use data which I do not give the extension through a expression, is there a way that I can acces my data from the application in my extension and not use qHyperCube?

layout.qFieldList gives me an array with all columns in my dataset, but I can not acces the data which is in these columns. Is there a method which I can call from qlikview.currApp() ?

Hope you guys can help me .

6 Replies
erik_wetterberg
Honored Contributor

Re: How do I load Data in my Extension without using an expression?

Hi Martien,

You do not need to use the functions in the mashup interface (qlik.currApp()) to get data to your extension. Instead you set up your data structure with initialProperties and set up a property panel where the user can set up Dimensions and Measures in the definition part of the extension.

Most extensions use a HyperCube. Check out the extension examples PeopleChart and SimpleTable for examples of this. Measures are not mandatory, it's perfactly OK to use only Dimensions. The rows in the HyperCube will represent the combination of Dimension values available in your data.

An option if you want only one Dimension (or Field) is to use a ListObject. An example of that is available in HorizList example. The rows in the ListObject are simply all values for the field.

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

Re: How do I load Data in my Extension without using an expression?

Hi Erik,

Tnx for your quick response, I think my question wasn't clear enough.

I want my extension to load a certain column of values, but I do not want to load then in my extension trough a dimension or expression. My Ideal solution would be if there would be a function, getData(fieldName). See the data column as a set of default values for my chart, which I do not want to hard code in my extension, but also do not want to bother the user with by making him fill in a dimension or expression. Is there a way to do this?


erik_wetterberg
Honored Contributor

Re: How do I load Data in my Extension without using an expression?

You can set up fields in your initialProperties. If you do not include them in your definition they will not be available for the user to change. That also means of course that your extension will not work in apps that do not have this field.

Add this to initialProperties to get the 'Month' field:

   qListObjectDef : {
   qDef: {qFieldDefs: ["Month"]},
   qShowAlternatives : true,
   qFrequencyMode : "V",
   qInitialDataFetch : [{
   qWidth : 2,
   qHeight : 50
   }]
   }
Erik Wetterberg
https://extendingqlik.upper88.com/
Not applicable

Re: How do I load Data in my Extension without using an expression?

Hi, Thank you!

Where can I find the created qListObjectDef?

 

To have some insight in my goal:

The extension user should be able to give some dimensions and measures to filter on etc. in the normal way, trough definition.

Me, the extension builder want to load some default values for the user trough initialProperties, which is loaded from a table and is needed for the extension, but the user does not need to change.

erik_wetterberg
Honored Contributor

Re: How do I load Data in my Extension without using an expression?

The qListObjectDef will be in properties. For rendering you will nedd the qListObject, which will be in layout.

Erik

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

Re: Re: How do I load Data in my Extension without using an expression?

you can fetch the initial data from layout.qListObject.qDataPages. The initial data page is specified within the qListObjectDef.qInitialDataFetch structure.

If you need to fetch additional data pages you can use the backendApi methods eachDataRow, getData or getDataRow.

Example using getData

var self = this, requestPage = [{ qTop : 0, qLeft : 0, qWidth : 1, qHeight : 20 }];

this.backendApi.getData(requestPage).then(function(dataPages)

{

     // Do something with data here

});

You can read more here https://help.qlik.com/sense/en-us/developer/index.html#../Subsystems/Workbench/Content/BuildingExten...

Community Browser