Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
chavanqlik
Partner - Contributor III
Partner - Contributor III

Validate Getapplist and store the value in console

I'm trying to check by this code snippet, but it's not working any insights, how to validate; if the list is not present, redirect or log it for now?: /*
* 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 config = {
host: window.location.hostname,
prefix: prefix,
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.setOnError( function ( error ) {
$( '#popupText' ).append( error.message + "<br>" );
$( '#popup' ).fadeIn( 1000 );
} );
$( "#closePopup" ).click( function () {
$( '#popup' ).hide();
} );


let myPromise = new Promise(function(myResolve, myReject) {
let x = 0;
var str = "";
qlik.getAppList(function(list,rep){

list.forEach(function(value) {
str += value.qDocName + '('+ value.qDocId +') ';
});

if (str.length > 0) {
myResolve("OK");
} else {
myReject("Error");
}

alert(str);
}, config)


}); myPromise.then(
function(value) {console.log(value);},
function(error) {console.log(error);}
);





});

0 Replies