Qlik Community

Integration, Extension & APIs

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

Announcements
IMPORTANT security patches for GeoAnalytics Server available to download: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
skumar2483
Contributor
Contributor

Create Mashup outside Qlik Server Repository folder

Hi,

I want to creating mashups outside the extensions folder. Is there any way to create a mashup for Qlik Sense outside its Extensions folder?

13 Replies
bcf
Employee
Employee

Hello Dayana,

Can you share the piece of code where you open the application using qlik.openApp(appName, configuration) ?

What are the configuration parameters that you're passing to this function?

vidayana
Contributor II
Contributor II

Hi, David!

I´m using Angular JS in my localhost (different server of the QlikSense Aplication) and in my View  I have this code that call the Excel in the controller:

<div  id="generateExcel" > Excel </div>

In the controller I manage this code in this way:

var prefix = window.location.pathname.substr( 0, window.location.pathname.toLowerCase().lastIndexOf( "/extensions" ) + 1 );

var config = {

   host: '11.2.33.444',   //the real host of Qlik Aplicattion and my server (localhost) is getting the objects from.

   prefix: '/', 

   port: 80, 

   isSecure: false 

};

var app;

require.config( {

  baseUrl: (config.isSecure ? "https://" : "http://" ) + config.host + (config.port ? ":" + config.port : "" ) + config.prefix + "resources"

} );

require( ["js/qlik"], function ( qlik ) {

//qlik app

var app;

//data for case listing

var data = {

headers: [],

rows: []

};

function getQlikApp () {

return qlik.openApp( "9595663-1642-4339-93315-2340", config )  //Qlik Sense Aplication ID

}

var appbi = angular.module( "appbi", ['ngRoute','ui.bootstrap', 'qlik-angular'] );

appbi.controller( "nameCtrl", ['$scope', function ( $scope ) {

if ( !app ) {

app = getQlikApp();

}

  app.getObject('tableID','xxYYzz'); // get the object of the table in the Qlik Sense Application

/*EXCEL*/

  angular.element('#generateExcel').click(function(e){ 

    app.getObject('xxYYzz').then(function(model) {

    var table = qlik.table(model);

        table.exportData({download: true});  

   });  

  });

}]);

The problem is when I click in the Excel button 😕

Instead the button function call the Excel from the host of application ("11.2.33.444") it is calling from my localhost.  If I change the server of the link, it works. For example:


Link that is generated from the function and don´t work:

link-local.jpg

Link that really works when I manually change the number of server:

link-server.jpg

Any help will be appreciated. Tnks


ErikWetterberg

Hi,

Looks like a bug in the download part. You will have to do the download yourself. Something like:

table.exportData().then(function(reply){

//reply contains the url

//add the correct host

//and call window.open

});

Hope this helps

Erik Wetterberg

vidayana
Contributor II
Contributor II

Hi, Erik!

Thanks! It worked!

The final function of download part:

  angular.element('#generateExcel').click(function(e){  

  app.getObject('xxYYzz').then(function(model) {

  var table = qlik.table(model);

  table.exportData({ download: false }, function (link) {

  var url = (config.isSecure ? "https://" : "http://") + config.host + link.replace('../..','') 

  window.open(url, "_blank");

  });

   });  

  }); 

I have to use link.replace('../..','')  part because the path of the url was being generated wrong, but fortunatelly now it is getting the host of the Qlik Application and downloading correctly!


I put {download: false} because it was generating twice (one from localhost and other from the host)


Thanks!