Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
s29124141
Partner - Creator II
Partner - Creator II

CreateCube Callback called more than once

I am trying to call createCube method to get table with 6 rows and 2 columns. I am getting the data in the callback function without any issues. But for some reason the callback method is called more than once and its intermittent. Could someone please help on this?

app.createCube({

                    "qInitialDataFetch": [

                       {

                           "qHeight": 20,

                           "qWidth": 2

                       }

                    ],

                    "qAlwaysFullyExpanded": true,

                    "qDimensions": [

                        {

                            "qDef": {

                                "qFieldDefs": [

                                    "_ProductDBFieldName"

                                ]

                            }

                        },

                        {

                            "qDef": {

                                "qFieldDefs": [

                                    "_ProductUIFieldName"

                                ]

                            }

                        }

                    ]

                }, function (productReply) {                   

                    CreateCubeCallback(productReply.qHyperCube.qDataPages[0].qMatrix, true);

                    app.destroySessionObject(productReply.qInfo.qId);

                });

1 Solution

Accepted Solutions
ErikWetterberg

Hi,

That is the way it is supposed to work. The callback Will be called every time the data changes, for example if the user makes a selection.

Erik Wetterberg

View solution in original post

4 Replies
ErikWetterberg

Hi,

That is the way it is supposed to work. The callback Will be called every time the data changes, for example if the user makes a selection.

Erik Wetterberg

s29124141
Partner - Creator II
Partner - Creator II
Author

Thanks Erik for the reply. Is there any way we can unbind the callback function once the first callback is received?

ErikWetterberg

Hi,

The createCube call returns a promise of a model, so you could do something like:

app.createCube(...).then(function(model){

//do something with the model, like close it....

});

but that might be tricky, you need to be sure you actually got the data before closing, so you will need to try it out.

An easies solution would be to simply ignore all subsequent calls, but that would cost you some performance.

Hope this helps

Erik

s29124141
Partner - Creator II
Partner - Creator II
Author

Thanks Erik for your response. I am calling the destroysessionobject as soon as the callback is received and ignoring subsequent callbacks.