Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
timmy
Partner - Contributor III
Partner - Contributor III

Qlik Sense integration/API - Same object (with same object ID) but different values/filters

Hi All,

I want to make a webpage based on one single app. On that specific app, I have an object (with object ID "KcGgdmk") that I want to show multiple times but every time with different filters ("Selectionvalues").

Below, you can find a working code but I used a workaround with 2 different virtual proxies. This is not a best practice way of integrating (I think 😁) one object with different filter values.

  • Who has experience with this? 
  • What is the best practice approach in this situation?

Code results (working with diff. virtual proxies):

/*
* Basic responsive mashup template
* @owner Enter you name here (xxx)
*/
/*
* Fill in host and port for Qlik engine
*/
var prefix = window.location.pathname.substr( 0, window.location.pathname.toLowerCase().lastIndexOf( "/extensions" ) + 1 );
var config2 = {
host: window.location.hostname,
prefix: "/gsm/",
port: window.location.port,
isSecure: window.location.protocol === "https:"
};
require.config( {
baseUrl: ( config2.isSecure ? "https://" : "http://" ) + config2.host + (config2.port ? ":" + config2.port : "") + config2.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();
} );

//callbacks -- inserted here --
//open apps -- inserted here --
var app = qlik.openApp('4e901674-7c28-420c-aef8-d7487f0cbf96', config2);

//get objects -- inserted here --
app.getObject('QV01','KcGgdmk');
app.field('ID').clear
app.field('ID').selectValues(["WO_02"]);
app.field('Filter').selectValues(["Aalst"]);
app.field('ID','Benchmark').clear
app.field('ID','Benchmark').selectValues(["WO_02"]);
app.field('Filter','Benchmark').selectValues(["Antwerpen"]);
//create cubes and lists -- inserted here --

var config1 = {
host: window.location.hostname,
prefix: "/gsm2/",
port: window.location.port,
isSecure: window.location.protocol === "https:"
};

require.config( {
baseUrl: ( config1.isSecure ? "https://" : "http://" ) + config1.host + (config1.port ? ":" + config1.port : "") + config1.prefix + "resources"
} );

//callbacks -- inserted here --
//open apps -- inserted here --
var app2 = qlik.openApp('4e901674-7c28-420c-aef8-d7487f0cbf96', config1);
//get objects -- inserted here --
app2.getObject('QV02','KcGgdmk');
app2.field('ID').clear
app2.field('Filter').clear
app2.field('ID').selectValues(["WO_02"]);
app2.field('Filter').selectValues(["Aalst"]);
app2.field('ID','Benchmark').clear
app2.field('Filter','Benchmark').clear
app2.field('ID','Benchmark').selectValues(["WO_02"]);
app2.field('Filter','Benchmark').selectValues(["Antwerpen"]);
//create cubes and lists -- inserted here --

} );

 

Qlik Sense , #API, #Embedding, #BestPractice, #NoobAlert

Labels (1)
  • API

3 Replies
ErikWetterberg

Try with alternate states. You would need to copy your object and connect the copies to alternate states. You can then make different selections in the different selection states.

timmy
Partner - Contributor III
Partner - Contributor III
Author

Hi Erik, 

Thanks for your reply.
What technique would you recommend to copy the object (via api)?