Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
dberkesacn
Contributor III

Mashup QS Desktop to Enterprise Server

Hi,

Could it be a problem if I develop a Mashup in the local host (Sense Desktop) with the mashup builder and after I upload / import it to Sense Server ?

Now I have Connection Lost msg when I would like to open the Mashup in Servers' QMC, with View button.

Thanks,

Daniel

1 Solution

Accepted Solutions
zoltan_farkas
New Contributor III

Re: Mashup QS Desktop to Enterprise Server

I've customized the code you attached but unfortunately it still doesn't work. I've used this code:

/* On localhost QlikSense Desktop */

if  ( location.host == 'localhost' ) {

console.log ( 'Detected Host: ' , hostName ) ;

var app = qlik.openApp('blah.qvf', config);

} ;

/* On QlikSense Test Server  blah */

if  ( location.host == 'blah' ) {

console.log ( 'Detected Host: ' , hostName ) ;

var app = qlik.openApp('blahId', config);

} ;


I've changed the hostName to location.host to get the information but something is wrong. I've tried your solution too but that didn't work either. It seems like a variable (hostName) but it doesn't have any value, that's why I was trying to get that information via location.host.


Any idea what could be the problem?


(Btw if I am just using one openApp method and change the Blah.qvf to the appID it works fine.)

8 Replies

Re: Mashup QS Desktop to Enterprise Server

Have you changed the openApp to point to the App ID of the app on the server ?

I normally use a few if statements like this to auto sort it :

/* On localhost QlikSense Desktop */

if  ( hostName == 'localhost' ) {

console.log ( 'Detected Host: ' , hostName ) ;

var app = qlik.openApp('blah.qvf', config);

} ;

/* On QlikSense Test Server  blah */

if  ( hostName == 'blah' ) {

console.log ( 'Detected Host: ' , hostName ) ;

var app = qlik.openApp('blahId', config);

} ;

/* On QlikSense Prod Server blah */

if  ( hostName == 'blah' ) {

console.log ( 'Detected Host: ' , hostName ) ;

var app = qlik.openApp('blahId', config);

} ;

You'll have to change all the blah 's to you you real names / id's.

zoltan_farkas
New Contributor III

Re: Mashup QS Desktop to Enterprise Server

Hi Bill,

Could you explain me this code please? And should I just put these lines in the javascript file?

Thanks,

Zoltan

Re: Mashup QS Desktop to Enterprise Server

Have a look at this entry in the online Help

Deploying your mashup to the repository ‒ Qlik Sense

Especially this bit I have pasted in :

2. Update the JavaScript file. In a Qlik Sense environment, the openApp function references an app ID instead of the app name. See the following examples.


Below this in the Help are examples of how to use openApp in QlikSense Desktop vs. Server which in essence is App Name vs. App ID.

zoltan_farkas
New Contributor III

Re: Mashup QS Desktop to Enterprise Server

I've customized the code you attached but unfortunately it still doesn't work. I've used this code:

/* On localhost QlikSense Desktop */

if  ( location.host == 'localhost' ) {

console.log ( 'Detected Host: ' , hostName ) ;

var app = qlik.openApp('blah.qvf', config);

} ;

/* On QlikSense Test Server  blah */

if  ( location.host == 'blah' ) {

console.log ( 'Detected Host: ' , hostName ) ;

var app = qlik.openApp('blahId', config);

} ;


I've changed the hostName to location.host to get the information but something is wrong. I've tried your solution too but that didn't work either. It seems like a variable (hostName) but it doesn't have any value, that's why I was trying to get that information via location.host.


Any idea what could be the problem?


(Btw if I am just using one openApp method and change the Blah.qvf to the appID it works fine.)

zoltan_farkas
New Contributor III

Re: Mashup QS Desktop to Enterprise Server

Bill, I finally managed to solve the issue, I had to use double quotes instead of single. Now it's working fine, thank you.

Re: Mashup QS Desktop to Enterprise Server

Ooops!!


Forgot to say the variable hostName needs setting first.

var hostName = window.location.hostname;


Then a console.log immediately after will say what it actually is in your environment


console.log ( 'Detected Host: ' , hostName ) ;

dberkesacn
Contributor III

Re: Mashup QS Desktop to Enterprise Server

thanks zoltan.farkas‌ and @bill.markham

Re: Mashup QS Desktop to Enterprise Server

Do beware though that if on the server you delete and recreate the app will get a new App ID and your MashUp will stop working until amended to reflect the new App Id.

But if you publish the App to a stream and then publish a new version of the App to replace it, then the App in the stream will retain its original App Id and the MashUp will continue working fine.  So best to do it this way.