Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
jacek_mossakows
Partner - Contributor
Partner - Contributor

Enigma.js get app list ->filter and open selected app

Hi,

firstly i want to say that i'm totally newbie in javascript. What i want to do is get app list from server, then filter returned array to get 1 app and then open that app and use app methods to get for example list of dimensions.

I've managed to get app list from server and to filter that result to get 1 appId. But i don't know how to use second global function method to open that app. Here is my code:

const createSession = require('./session');

var fs = require('fs');

const session = createSession();


session.open()

.then(function(global) {

global.getDocList().then(function(docList) {


console.log(JSON.stringify(docList));

for (i = 0; i < docList.length; i++) {

var AppName = docList[i].qDocName;

console.log('Field list:',JSON.stringify(AppName));

}

var docId = docList.filter(obj => obj.qTitle =='test222' )[0].qDocId;

console.log(docId);

session.close();

return docId;

}, function(err) { console.log('5')})

}, function(err) { console.log('It seems Sense is not responding')});

I need to pass docId to global.OpenApp() method

Hope you will help me!

Thanks

1 Reply
Prashant_Naik
Partner - Creator II
Partner - Creator II

Hello Jacek,

I have just added one line to open the app which you wanted

here's the code

const createSession = require('./session');

var fs = require('fs');

const session = createSession();

session.open()

.then(function(global) {

global.getDocList().then(function(docList) {

console.log(JSON.stringify(docList));

for (i = 0; i < docList.length; i++) {

var AppName = docList[i].qDocName;

console.log('Field list:',JSON.stringify(AppName));

}

var docId = docList.filter(obj => obj.qTitle =='test222' )[0].qDocId;

console.log(docId);

global.openDoc(docId); //this is the line i have added

session.close();

return docId;

}, function(err) { console.log('5')})

}, function(err) { console.log('It seems Sense is not responding')});

Try this

Thanks & regards,

Prashant