Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
jason_robertson
Partner - Contributor II
Partner - Contributor II

Qlik Sense API Objects and Destroying

We have upgraded from QlikSense 3.1 to QlikSense June 2017 Patch 1 in our dev environment and one of the extensions we use is now failing in the newer version.  We are using a Show/Hide extension (GitHub - fadyheiba/ShowHide: This Qlik Sense extension is a container that shows or hides visualizat...) to toggle between showing two different charts on a sheet based on a drop down selection. The gist of what happens is for the currently selected chart the command

$scope.app.getObject($element.find('div'), $scope.currentChart) is used. 

When the toggle is used to select a different chart the following code is executed to destroy the currently created chart.

function destroyObject() {

  return $scope.app.destroySessionObject($scope.currentChartModel.layout.qInfo.qId)

    .then(function() {return $scope.currentChartModel.close();})

    .then(function() {$scope.currentChartModel = null;});

};


The getObject api is then called again with the correct id to get the new chart based on what was selected.  The problem begins when we try to toggle back to a chart that has already been displayed. An exception is thrown when the internal engine tries to set the layout for the control to display.


TypeError: Cannot read property 'qType' of undefined

    at Object.f.setLayout (/resources/assets/client/client.js??1499952235400:69)

    at a.c [as fn] (/resources/assets/client/client.js??1499952235400:69)

This is happening because the getLayout call (in the qlik js code) does not return the correct data. (Basically returns nothing).


If I take the destroySessionObject call out everything appears to work as expected.

I have also converted the code to use the visualization api instead. Using the close method of the QVisualization in place of the destroySessionObject and the app.visualization.get in place of getObject() and I see the same behavior.


So is the call to destroy or close necessary?  (I cannot find any qlik documents stating you should always do this.)

Does this sound like a potential bug in the new version or is this extension not doing things correctly? (I am new to qlik development)

(There is also an example qvf at the above github address that will demonstrate the same behavior. The ShowHide: Buttoms sheet is a good example)


Any help would be greatly appreciated.


Thanks.



1 Solution

Accepted Solutions
jason_robertson
Partner - Contributor II
Partner - Contributor II
Author

Qlik Sense September 2017 Patch #1 has corrected the issue.

Thanks to Qlik Support for their continued effort.

View solution in original post

8 Replies
nferna001
Partner - Contributor II
Partner - Contributor II

I would actually like some feedback from Qlik, as i'm having the same problem. Why is this question unanswered almost a month and a half after?

jason_robertson
Partner - Contributor II
Partner - Contributor II
Author

I ended up opening a support ticket with Qlik and it is a bug.

A fix was supposed to have dropped yesterday in the Qlik September 2017 release.

I should be able to test in our dev environment shortly.

nferna001
Partner - Contributor II
Partner - Contributor II

Thank you for the response. I'll update and check. I'll open another thread if something fails

xavier_jordioll
Partner - Contributor
Partner - Contributor

Hi Jason,

I'm experiencing the same issue. Was your problem solved with the new release?

Thanks,

Xavi

jason_robertson
Partner - Contributor II
Partner - Contributor II
Author

Unfortunately no.  I am waiting to hear back from Qlik support for an explanation.

jaisoni_trp
Creator II
Creator II

We also have same issue and waiting for Qlik to respond.

jason_robertson
Partner - Contributor II
Partner - Contributor II
Author

Still an issue.  They have another bug QLIK-81736 that is supposed to resolve the destroy issue which should hopefully resolve this issue as well.

This is supposed to drop in Patch 1 for the Sept 2017 release. 

Will update the thread when I see this update drop and test.

jason_robertson
Partner - Contributor II
Partner - Contributor II
Author

Qlik Sense September 2017 Patch #1 has corrected the issue.

Thanks to Qlik Support for their continued effort.