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

Qlik Sense JS Extension createTable() does not return values

Hi,

I have some trouble with creating table in Qlik Sense extension.

If I wrote:

let object = app.createTable(dimensions,{rows:1000});

console.log('object: ', object);

Promise.all([object]).then(function(values){

       console.log('rows: ', object.rows);

       console.log('qHyperCube: ', object.qHyperCube);

});


I get

Screen Shot 2018-01-26 at 08.13.05.png


Witch I don't understand:


- we can see that when I print whole object I can see rows (and they are right) and qHyperCube witch has same rows inside.

- But when I wan't to extract this information I get empty array/undefined object


- I understand that createTable only return promise,....


How do you do this?


Marko Zadravec

1 Solution

Accepted Solutions
ErikWetterberg

Hi,

You need to wait for the OnData event before the rows are actually available.

The fact that you see them in the console is because Chrome doesnt check inside the object until you click on the arrow, at which time the data will be available.

Hope this helps

Erik Wetterberg

View solution in original post

4 Replies
ErikWetterberg

Hi,

You need to wait for the OnData event before the rows are actually available.

The fact that you see them in the console is because Chrome doesnt check inside the object until you click on the arrow, at which time the data will be available.

Hope this helps

Erik Wetterberg

Anonymous
Not applicable
Author

Yes this is true,

I figure out that I need to bind observer to table, to check when data come.

I don't know why, but Promise.all doesn't work.

ErikWetterberg

Promise.all does work, but the promise resolves when the table object is available, which is earlier than it has data, the framework needs to call getLayout to get the data.

Erik Wetterberg

sanket_raj
Contributor II
Contributor II

How did you bind observer to table? I tried using below code but it is not working:

 

var table = qlik.table( this ); var listener = function() { var rowCount = table.rowCount; var colCount = table.colCount; table.OnData.unbind( listener ); //unregister the listener when no longer notification is needed. }; table.OnData.bind( listener ); //bind the listener