Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Qlik Sense Mashup qheight dynamically

Hello,

I am developing a mashup project.

I want to set value to qheight in CreateList method dynamically. But I don't know how to set value qheight. Do you have information about this topic ?

app.createList({

  "qFrequencyMode": "V",

  "qDef": {

  "qFieldDefs": [

  "Personel Sicil Ad Soyad"

  ]

  },

  "qExpressions": [],

  "qInitialDataFetch": [

  {

  "qHeight":1,

  "qWidth": 10000 //  it must be dynamically

  }

  ],

  "qLibraryId": null

  },SearchCV);

1 Solution

Accepted Solutions
websy1985
Luminary Alumni
Luminary Alumni

It's probably best not to use the pageHeight variable for looping through the response data. This is because you may have requested 500 rows for example, but only received 200. Also, the page object returned in the promise is also an array so, assuming you've only requested a single page, I would do this instead -

for (var i = 0; i <page[0].qMatrix.length; i++) {

  data.push(page[0].qMatrix.length[0].qText);

}

This also assumes that you have an array variable called data that is available in the current scope.

View solution in original post

6 Replies
Yianni_Ververis
Employee
Employee

try 0

Not applicable
Author

I tried it but i didn't get data

websy1985
Luminary Alumni
Luminary Alumni

You could omit the qInitialDataFetch property and use the getListObjectData function to fetch the data after the object has been instantiated, like this -

app.createList({
       "qFrequencyMode": "V",
       "qDef": {
          "qFieldDefs": [
            "Personel Sicil Ad Soyad"
          ]
       },
       "qExpressions": [],
       "qLibraryId": null
       }).then(function(response){
          var pageWidth = response.layout.qListObject.qSize.qcx;
          var pageHeight = Math.floor(10000, pageWidth);
          return response.enigmaModel.getListObjectData("/qListObjectDef", [{qTop: 0, qLeft:0, qHeight: pageHeight, qWidth: pageWidth}])
     }).then(function(page){
       //page should have data according to the above page request       
     });
Not applicable
Author

Hello Nick

How to write code below function. Is it true below ?

....

}).then(function(page){

//page should have data according to the above page request

for (var i = 0; i < pageHeight; i++) {

  data.push(page.qMatrix[0].qText);

  }

});

websy1985
Luminary Alumni
Luminary Alumni

It's probably best not to use the pageHeight variable for looping through the response data. This is because you may have requested 500 rows for example, but only received 200. Also, the page object returned in the promise is also an array so, assuming you've only requested a single page, I would do this instead -

for (var i = 0; i <page[0].qMatrix.length; i++) {

  data.push(page[0].qMatrix.length[0].qText);

}

This also assumes that you have an array variable called data that is available in the current scope.

Not applicable
Author

Thanks a lot