Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
AG-gugelbisolutions
Creator II
Creator II

QVisualization.show not working with session app

Hi there, I'm pretty new to mashups/extensions development and I'm learning starting from tutorials with QSEoW.

I went through a first tutorial without any particular issue, but then I tried to build a session app. I'm able to create the app, set the script, reload and create an object but, for some reasons, I'm not able to show the object in the html page. It actually fill the div with a qv-object, but it 's empty. Here is a simplified version of my code.

var config = {
	host: window.location.hostname,
	prefix: window.location.pathname.substr( 0, window.location.pathname.toLowerCase().lastIndexOf( "/extensions" ) + 1 ),
	port: window.location.port,
	isSecure: window.location.protocol === "https:"
};
require.config( {
	baseUrl: ( config.isSecure ? "https://" : "http://" ) + config.host + (config.port ? ":" + config.port : "") + config.prefix + "resources"
} );

require( ["js/qlik"], function ( qlik ) {
	
	qlik.on( "error", function ( error ) {
		$( '#popupText' ).append( error.message + "<br>" );
		$( '#popup' ).fadeIn( 1000 );
	} );
	$( "#closePopup" ).click( function () {
		$( '#popup' ).hide();
	} );

	var sessionApp = qlik.sessionApp(config);
	var script = "Load Chr(RecNo()+Ord('A')-1) as Alpha, RecNo() as Num autogenerate 26;"

	sessionApp.setScript(script).then(function(setScriptResult){

		sessionApp.doReload().then(function(doReloadResult){

			sessionApp.visualization.create('barchart',["Alpha","=Sum([Num])"],{title:"Bar chart on the fly"}).then(function(bar){
				
				console.log(bar.model.id);
				bar.show("QV01");

				/*bar.exportData({format:'CSV_T', state: 'A'}).then(function (link) {
					window.open(link);
				});*/
			});
		})
	});
} );

Please note that I'm even able to export a csv file with the table model behind the visualization! 

And here is the html file

<!doctype html>
<html>
<head>
	<title>First Mashup Example</title>
	<meta charset="utf-8">
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" href="../../resources/autogenerated/qlik-styles.css">
	<script src="../../resources/assets/external/requirejs/require.js"></script>
	<script src="FirstMashupExample.js"></script>

	<style>
		<!--div.flex-container {
			display: flex;
			flex-wrap: wrap;
			margin: 0 45px 45px 0;
		}
		div.qvobject {
			flex: 1 1 auto;
			height: 300px;
			min-width: 400px;
			margin: 45px 0 0 45px;
			position: relative
		}-->
	</style>
</head>

<body>

	<div class="flex-container">
		<div id="QV01" class="qvobject"></div>
		<div id="QV02" class="qvobject"></div>
		<div id="QV03" class="qvobject"></div>
		<div id="QV04" class="qvobject"></div>
		<div id="QV05" class="qvobject"></div>
		<div id="QV06" class="qvobject"></div>
	</div>
	<div id="popup">
		<button type="button" class="close" data-dismiss="modal" aria-label="Close" id="closePopup"><span aria-hidden="true">�</span></button>
		<p id="popupText"></p>
	</div>
</body>
</html>

 

What happens?

Labels (4)
5 Replies
rzenere_avvale
Partner - Specialist II
Partner - Specialist II

Hey there   @AG-gugelbisolutions ,

I tried your code on Chrome using QS Desktop (May 2022 Technical Preview) and QS Enterprise on Windows (August 2021 Patch 2) and the mashup runs smoothly, rendering the barchart 

Could you share a bit more of info what is your testing environment?

A generic suggestion could be to call the qlik.resize() method once the object is rendered (which means that you need to know when an object is actually rendered) or at least after you call the bar.show("QV01");

I hope this helps,
Riccardo

AG-gugelbisolutions
Creator II
Creator II
Author

I'm using QSD and QSEoW February 2022, on Windows Server 2021 SE.

Tried bar.resize() but with no luck.

Thanks anyway.

 

Any other ideas? Anyone else is experiencing this issue?

AG-gugelbisolutions
Creator II
Creator II
Author

It might be a security-related issue as I found this kind of error within logs, Proxy logs to be precise:

1278	14.19.1.0	20220506T223355.824+0200	ERROR	WS2019-ICARO	38dac926-7651-4f32-b396-10eed6ae687a	Command=Open connection;Result=-2146233087;ResultText=Error: A call to SSPI failed, see inner exception.	0	0	0	INTERNAL	sa_proxy	0	Not available	Proxy	Not available	Not available	Open connection	-2146233087	Error when accepting client connection: 'A call to SSPI failed, see inner exception.'	38dac926-7651-4f32-b396-10eed6ae687a

TLS is apparently not active on my server; can it be the reason?

Thanks

AG-gugelbisolutions
Creator II
Creator II
Author

While I'm not sure whether it is a security issue or not (as I'm working on localhost), I would like to post how the mashup is rendered. Please note that I have changed the HTML file.

AGgugelbisolutions_0-1651919236861.png

 

As you can see the qv-object is empty (and therefore its size is 0x0). It seems like the show method is not injecting the right html code for some reasons.

Any ideas?  

 

AG-gugelbisolutions
Creator II
Creator II
Author

Strange things happens: if I build a sessionAppFromApp, everything works.

This fairly old post describes the same issue. 

Which could be the reason?