0 Replies Latest reply: Sep 12, 2018 11:08 AM by Jacek Mossakowski RSS

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

    Jacek Mossakowski

      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