Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Qlikuser09
Creator II
Creator II

Integrating 2 apps and creating common filter between apps

Attached is the Json code for integerating apps and adding common filter between apps, how evr the code only makes changes to its respective apps and not integrating.

 

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

 

var app1 = qlik.openApp('app1', config);

 

function AppUi ( app ) {

var me = this;

this.app = app;

app.global.isPersonalMode( function ( reply ) {

me.isPersonalMode = reply.qReturn;

} );

app.getAppLayout( function ( layout ) {

$( "#title" ).html( layout.qTitle );

$( "#title" ).attr( "title", "Last reload:" + layout.qLastReloadTime.replace( /T/, ' ' ).replace( /Z/, ' ' ) );

//TODO: bootstrap tooltip ??

} );

app.getList( 'SelectionObject', function ( reply ) {

$( "[data-qcmd='back']" ).parent().toggleClass( 'disabled', reply.qSelectionObject.qBackCount < 1 );

$( "[data-qcmd='forward']" ).parent().toggleClass( 'disabled', reply.qSelectionObject.qForwardCount < 1 );

} );

app.getList( "BookmarkList", function ( reply ) {

var str = "";

reply.qBookmarkList.qItems.forEach( function ( value ) {

if ( value.qData.title ) {

str += '<li><a data-id="' + value.qInfo.qId + '">' + value.qData.title + '</a></li>';

}

} );

str += '<li><a data-cmd="create">Create</a></li>';

$( '#qbmlist' ).html( str ).find( 'a' ).on( 'click', function () {

var id = $( this ).data( 'id' );

if ( id ) {

app.bookmark.apply( id );

} else {

var cmd = $( this ).data( 'cmd' );

if ( cmd === "create" ) {

$( '#createBmModal' ).modal();

}

}

} );

} );

$( "[data-qcmd]" ).on( 'click', function () {

var $element = $( this );

switch ( $element.data( 'qcmd' ) ) {

//app level commands

case 'clearAll':

app.clearAll();

app1.clearAll();

break;

case 'back':

app.back();

app1.back();

break;

case 'forward':

app.forward();

app1.forward();

break;

case 'lockAll':

app.lockAll();

app1.lockAll();

break;

case 'unlockAll':

app.unlockAll();

app1.unlockAll();

break;

case 'createBm':

var title = $( "#bmtitle" ).val(), desc = $( "#bmdesc" ).val();

app.bookmark.create( title, desc );

$( '#createBmModal' ).modal( 'hide' );

break;

}

} );

}

//get objects -- inserted here --

app1.getObject('filter1','9185272');

 

 

 

app1.getObject('QV03','c5ba1');

app1.getObject('filter2','1fe17');

app.getObject('QV01','nPg');

 

 

 

 

 

 

if ( app ) {

new AppUi( app );

}

 

var appSelectionviaAPI=false;

var app1SelectionviaAPI=false;

 

var selState = app.selectionState( );

var listener = function() {

         

         app1.clearAll();

            var selFields = selState.selections;

var cacheString="";

 

if (selFields!=null){

$.each(selFields, function(key, value) {

var valArray=[];

$.each(value.selectedValues, function(key,value){

isNaN(value.qName) ? valArray.push(value.qName):valArray.push(Number(value.qName));

})

cacheString=cacheString + '@' + value.fieldName +"~" + value.qSelected;

app1.field(value.fieldName).selectValues(valArray);

 

 

});

localStorage.setItem("QlikFilter",cacheString);

}

 

          };

          selState.OnData.bind( listener );

retrieveSelectionfromCache();

 

function retrieveSelectionfromCache()

{

var cacheString= localStorage.getItem("QlikFilter");                

if (cacheString!=null && cacheString !=""){

app.clearAll();

var selFields=cacheString.split("@");        

 

$.each(selFields, function(key, value) {

if (value!=null && value!=""){

var valArray=[];

var s = value.split("~");

var fieldName=s[0];

valArray = s[1].split(", ");                                

app.field(fieldName).selectValues(valArray);

}

});

}

else{

app.clearAll();

}        

}

 

Labels (2)
1 Reply
J_Lindberg
Support
Support

Hello @Qlikuser09 

It appears that this question has ended up in the wrong forum. In this forum we're able to help you with Qlik Application Automation related questions. Qlik Application Automation provides a no-code visual interface that helps you easily build automated analytics and data workflows. 
It would be great if you could post this question in the forum related to the product you are using and you will get help there.