<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SelectValues in Realtime using enigma.js in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/SelectValues-in-Realtime-using-enigma-js/m-p/1652635#M11896</link>
    <description>&lt;P&gt;Is there any other possibility to connect live to the Front End?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 29 Nov 2019 10:50:39 GMT</pubDate>
    <dc:creator>juwa</dc:creator>
    <dc:date>2019-11-29T10:50:39Z</dc:date>
    <item>
      <title>SelectValues in Realtime using enigma.js</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/SelectValues-in-Realtime-using-enigma-js/m-p/1649543#M11838</link>
      <description>&lt;P&gt;At first I want to say that I am a absolute JavaScript Beginner.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My goal is to find a way setting a filter in my Qlik sense APP with an external Action.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought about using einigma.js for pushing the "Select values" method to automatically getting applied in Realtime (without refreshing Browser!).&lt;/P&gt;&lt;P&gt;If there is any other way or solution I would be more than thankful for every hint.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Here is what I tried till now using node.js:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;const serverUri = 'localhost';&lt;BR /&gt;const clientCertFile = '.\\client.pem';&lt;BR /&gt;const clientCertKey = '.\\client_key.pem';&lt;BR /&gt;const enigma = require('./node_modules/enigma.js/enigma.min.js');&lt;BR /&gt;const WebSocket = require('ws');&lt;BR /&gt;const fs = require('fs');&lt;BR /&gt;const schema = require('./node_modules/enigma.js/schemas/12.170.2.json');&lt;BR /&gt;// match this schema to your Qlik Sense version.&lt;BR /&gt;const defaultCertPath = 'C:\\ProgramData\\Qlik\\Sense\\Repository\\Exported Certificates\\.Local Certificates';&lt;/P&gt;&lt;P&gt;const session = enigma.create({&lt;BR /&gt;schema,&lt;BR /&gt;url: `wss://${serverUri}:4747/app/engineData`,&lt;BR /&gt;createSocket: url =&amp;gt; new WebSocket(url, {&lt;BR /&gt;rejectUnauthorized: false,&lt;BR /&gt;//ca: [fs.readFileSync('.\\root.pem')], // you can skip ca if you set rejectUnautzoried to false&lt;BR /&gt;key: fs.existsSync(clientCertKey)?fs.readFileSync(clientCertKey)&lt;BR /&gt;:fs.readFileSync(`${defaultCertPath}\\client_key.pem`),&lt;BR /&gt;cert: fs.existsSync(clientCertFile)?fs.readFileSync(clientCertFile)&lt;BR /&gt;:fs.readFileSync(`${defaultCertPath}\\client.pem`),&lt;BR /&gt;headers: { "X-Qlik-User": 'UserDirectory=INTERNAL;UserId=sa_engine' }&lt;BR /&gt;})&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;var addToApp = '4c85c23b-19f2-4bd1-952d-5627618ba044';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;session.open().then(function (global) {&lt;BR /&gt;console.log('&amp;gt;&amp;gt; Session was opened successfully');&lt;BR /&gt;var app;&lt;BR /&gt;var origScript;&lt;BR /&gt;//console.log(global);&lt;BR /&gt;return global.engineVersion().then(ret =&amp;gt; {&lt;BR /&gt;console.log('Engine Version: ', ret);&lt;BR /&gt;//return global.getDocList();&lt;BR /&gt;return global.openDoc(addToApp);&lt;BR /&gt;}).then(ret =&amp;gt; {&lt;BR /&gt;app = ret;&lt;BR /&gt;return app.getScript();&lt;BR /&gt;}).then(script =&amp;gt; {&lt;BR /&gt;origScript = script;&lt;BR /&gt;script = [];&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;//Here ist the main part:&lt;/STRONG&gt;&lt;/U&gt;&lt;BR /&gt;&lt;STRONG&gt;script.push(`//header of generated script`);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;script.push("var qlikapp = qlik.currApp()")&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;script.push("qlikapp.field('Kalender.Year').selectValues([2019],false,true);")&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;script.push(`//footer of generated script`);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;script = script.join('\n'); // implode script array into new-line separated string&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;console.log('---begin of new script---\n');&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;console.log(script);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;console.log('\n---end of new script---');&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;return app.setScript(script);&lt;/STRONG&gt;&lt;BR /&gt;}).then(ret =&amp;gt; {&lt;BR /&gt;console.log('&amp;gt;&amp;gt; App script changed, now reloading (pushing new data):');&lt;BR /&gt;return app.doReload(0, true); // true = Partial Reload&lt;BR /&gt;}).then(ret =&amp;gt; {&lt;BR /&gt;console.log('&amp;gt;&amp;gt; Reload finished: ', ret);&lt;BR /&gt;return app.setScript(origScript);&lt;BR /&gt;}).then(ret =&amp;gt; {&lt;BR /&gt;console.log('&amp;gt;&amp;gt; Load script reverted to original script. Now saving.');&lt;BR /&gt;return app.doSave();&lt;BR /&gt;}).catch(error =&amp;gt; {&lt;BR /&gt;console.error('Error', error);&lt;BR /&gt;});&lt;BR /&gt;}).then(ret =&amp;gt; {&lt;BR /&gt;session.close();&lt;BR /&gt;console.log('&amp;gt;&amp;gt; Done.');&lt;BR /&gt;}).catch(error =&amp;gt; {&lt;BR /&gt;console.error('Error', error);&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Node generates the following output, but nothing happens:&amp;nbsp;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt; Session was opened successfully&lt;BR /&gt;Engine Version: { qComponentVersion: '12.421.3' }&lt;BR /&gt;---begin of new script---&lt;/P&gt;&lt;P&gt;//header of generated script&lt;BR /&gt;var qlikapp= qlik.currApp()&lt;BR /&gt;qlikapp.field('Kalender.Year').selectValues([2019],false,true);&lt;BR /&gt;//footer of generated script&lt;/P&gt;&lt;P&gt;---end of new script---&lt;BR /&gt;&amp;gt;&amp;gt; App script changed, now reloading (pushing new data):&lt;BR /&gt;&amp;gt;&amp;gt; Reload finished: false&lt;BR /&gt;&amp;gt;&amp;gt; Load script reverted to original script. Now saving.&lt;BR /&gt;&amp;gt;&amp;gt; Done.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would be more than happy to get any hint. Thanks!&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 19:37:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/SelectValues-in-Realtime-using-enigma-js/m-p/1649543#M11838</guid>
      <dc:creator>juwa</dc:creator>
      <dc:date>2024-11-16T19:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: SelectValues in Realtime using enigma.js</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/SelectValues-in-Realtime-using-enigma-js/m-p/1650777#M11854</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;As I don't have the app, it's difficult to reproduce the issue.&lt;/P&gt;&lt;P&gt;But I think you could keep using object received from Enigma instead of using scripts. I think you will have a better feedback on the eventual issues. Also don't forget to use .catch() when you use a Promise &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;It will be something like this :&lt;/P&gt;&lt;PRE&gt;app.getField('Year')&lt;BR /&gt;  .then(field =&amp;gt; {&lt;BR /&gt;    return field.selecValues([2019]);&lt;BR /&gt;  })&lt;BR /&gt;  .then((successful) =&amp;gt; {&lt;BR /&gt;    if(successful) {&lt;BR /&gt;      console.log('Selection done');&lt;BR /&gt;    } else {&lt;BR /&gt;      console.error('Selection failed);&lt;BR /&gt;    }&lt;BR /&gt;  })&lt;BR /&gt;  .catch(console.error);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Here the documentation about the used function :&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/sense-developer/September2018/apis/EngineAPI/services-Doc-GetField.html" target="_blank" rel="noopener"&gt;https://help.qlik.com/en-US/sense-developer/September2018/apis/EngineAPI/services-Doc-GetField.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/sense-developer/September2018/apis/EngineAPI/services-Field-SelectValues.html" target="_blank" rel="noopener"&gt;https://help.qlik.com/en-US/sense-developer/September2018/apis/EngineAPI/services-Field-SelectValues.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2019 16:08:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/SelectValues-in-Realtime-using-enigma-js/m-p/1650777#M11854</guid>
      <dc:creator>GuillaumeBt</dc:creator>
      <dc:date>2019-11-25T16:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: SelectValues in Realtime using enigma.js</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/SelectValues-in-Realtime-using-enigma-js/m-p/1652613#M11895</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;i dont understand what you exactly want&lt;/P&gt;&lt;P&gt;engine api only works on backend side.. it will not reflect on front end..&lt;/P&gt;&lt;P&gt;if you are selecting some field using engine api it will not select anything on front end..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks Regards&lt;/P&gt;&lt;P&gt;Harsh Gohil&lt;/P&gt;</description>
      <pubDate>Fri, 29 Nov 2019 10:03:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/SelectValues-in-Realtime-using-enigma-js/m-p/1652613#M11895</guid>
      <dc:creator>iharsh220</dc:creator>
      <dc:date>2019-11-29T10:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: SelectValues in Realtime using enigma.js</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/SelectValues-in-Realtime-using-enigma-js/m-p/1652635#M11896</link>
      <description>&lt;P&gt;Is there any other possibility to connect live to the Front End?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Nov 2019 10:50:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/SelectValues-in-Realtime-using-enigma-js/m-p/1652635#M11896</guid>
      <dc:creator>juwa</dc:creator>
      <dc:date>2019-11-29T10:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: SelectValues in Realtime using enigma.js</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/SelectValues-in-Realtime-using-enigma-js/m-p/1652665#M11897</link>
      <description>&lt;P&gt;Yes it is possible.. you have to write code for ticket also you have to add qlik session cookies in headers&lt;/P&gt;&lt;P&gt;And your port must be 4243 i can share you link tommrow..&lt;/P&gt;</description>
      <pubDate>Fri, 29 Nov 2019 11:55:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/SelectValues-in-Realtime-using-enigma-js/m-p/1652665#M11897</guid>
      <dc:creator>iharsh220</dc:creator>
      <dc:date>2019-11-29T11:55:12Z</dc:date>
    </item>
    <item>
      <title>Re: SelectValues in Realtime using enigma.js</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/SelectValues-in-Realtime-using-enigma-js/m-p/1652820#M11905</link>
      <description>&lt;P&gt;var qsocks = require('qsocks');&lt;BR /&gt;var fs = require('fs');&lt;BR /&gt;var request = require('request');&lt;BR /&gt;const enigma = require('enigma.js');&lt;BR /&gt;const schema = require('enigma.js/schemas/12.20.0.json');&lt;BR /&gt;const SenseUtilities = require('enigma.js/sense-utilities');&lt;BR /&gt;const WebSocket = require('ws');&lt;/P&gt;&lt;P&gt;//Set our request defaults, ignore unauthorized cert warnings as default QS certs are self-signed.&lt;BR /&gt;var r = request.defaults({&lt;BR /&gt;rejectUnauthorized: false,&lt;BR /&gt;host: 'Qlik Url', // enter qlik Url&lt;BR /&gt;pfx: fs.readFileSync(__dirname+'\\Certificates\\client.pfx')&lt;BR /&gt;})&lt;/P&gt;&lt;P&gt;//Authenticate whatever user you want&lt;BR /&gt;var b = JSON.stringify({&lt;BR /&gt;"UserDirectory": 'UserDirectory', // enter your UserDirectory&lt;BR /&gt;"UserId": 'UserId', // enter your UserId&lt;BR /&gt;"Attributes": []&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;//Get ticket for user&lt;BR /&gt;r.post({&lt;BR /&gt;uri: 'https://Qlikurl:4243/qps/ticket?xrfkey=abcdefghijklmnop', // enter qlik Url :4243&lt;BR /&gt;body: b,&lt;BR /&gt;headers: {&lt;BR /&gt;'x-qlik-xrfkey': 'abcdefghijklmnop',&lt;BR /&gt;'content-type': 'application/json'&lt;BR /&gt;}&lt;BR /&gt;},&lt;BR /&gt;function(err, res, body) {&lt;/P&gt;&lt;P&gt;//Consume ticket, set cookie response in our upgrade header against the proxy.&lt;BR /&gt;var ticket = JSON.parse(body)['Ticket'];&lt;BR /&gt;r.get('https://Qlikurl/hub/?qlikTicket=' + ticket, function(error, response, body) {&lt;/P&gt;&lt;P&gt;var cookies = response.headers['set-cookie'];&lt;BR /&gt;//qsocks config, merges into standard https/http object headers.&lt;BR /&gt;//Set the session cookie correctly.&lt;BR /&gt;var config = {&lt;BR /&gt;host: 'Your Host', // your host Qlik Url&lt;BR /&gt;isSecure: true,&lt;BR /&gt;port: 443,&lt;BR /&gt;origin: 'http://localhost',&lt;BR /&gt;rejectUnauthorized: false,&lt;BR /&gt;headers: {&lt;BR /&gt;"Content-Type": "application/json",&lt;BR /&gt;"Cookie": cookies[0]&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;qsocks.Connect(config).then(function(global) {&lt;BR /&gt;global.openDoc("Put Your AppId").then(function(app){&lt;BR /&gt;app.getField("Country").then(function(field){&lt;BR /&gt;var selected=[&lt;BR /&gt;{&lt;BR /&gt;"qText": "Germany",&lt;BR /&gt;"qIsNumeric": false,&lt;BR /&gt;"qNumber": 0&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;field.selectValues(selected).then(function(selection){&lt;BR /&gt;console.log(selection);&lt;BR /&gt;});&lt;BR /&gt;//field.selectAll();&lt;BR /&gt;//field.clear();&lt;BR /&gt;})&lt;BR /&gt;})&lt;BR /&gt;})&lt;BR /&gt;})&lt;BR /&gt;})&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;check this out if it will work for you&lt;/P&gt;&lt;P&gt;Thanks Regards&lt;/P&gt;&lt;P&gt;Harsh Gohil&lt;/P&gt;</description>
      <pubDate>Sat, 30 Nov 2019 05:13:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/SelectValues-in-Realtime-using-enigma-js/m-p/1652820#M11905</guid>
      <dc:creator>iharsh220</dc:creator>
      <dc:date>2019-11-30T05:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: SelectValues in Realtime using enigma.js</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/SelectValues-in-Realtime-using-enigma-js/m-p/1652822#M11906</link>
      <description>&lt;P&gt;var qsocks = require('qsocks');&lt;BR /&gt;var fs = require('fs');&lt;BR /&gt;var request = require('request');&lt;BR /&gt;const enigma = require('enigma.js');&lt;BR /&gt;const schema = require('enigma.js/schemas/12.20.0.json');&lt;BR /&gt;const SenseUtilities = require('enigma.js/sense-utilities');&lt;BR /&gt;const WebSocket = require('ws');&lt;/P&gt;&lt;P&gt;//Set our request defaults, ignore unauthorized cert warnings as default QS certs are self-signed.&lt;BR /&gt;var r = request.defaults({&lt;BR /&gt;rejectUnauthorized: false,&lt;BR /&gt;host: 'Qlik Url', // enter qlik Url&lt;BR /&gt;pfx: fs.readFileSync(__dirname+'\\Certificates\\client.pfx')&lt;BR /&gt;})&lt;/P&gt;&lt;P&gt;//Authenticate whatever user you want&lt;BR /&gt;var b = JSON.stringify({&lt;BR /&gt;"UserDirectory": 'UserDirectory', // enter your UserDirectory&lt;BR /&gt;"UserId": 'UserId', // enter your UserId&lt;BR /&gt;"Attributes": []&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;//Get ticket for user&lt;BR /&gt;r.post({&lt;BR /&gt;uri: 'https://Qlikurl:4243/qps/ticket?xrfkey=abcdefghijklmnop', // enter qlik Url :4243&lt;BR /&gt;body: b,&lt;BR /&gt;headers: {&lt;BR /&gt;'x-qlik-xrfkey': 'abcdefghijklmnop',&lt;BR /&gt;'content-type': 'application/json'&lt;BR /&gt;}&lt;BR /&gt;},&lt;BR /&gt;function(err, res, body) {&lt;/P&gt;&lt;P&gt;//Consume ticket, set cookie response in our upgrade header against the proxy.&lt;BR /&gt;var ticket = JSON.parse(body)['Ticket'];&lt;BR /&gt;r.get('https://Qlikurl/hub/?qlikTicket=' + ticket, function(error, response, body) {&lt;/P&gt;&lt;P&gt;var cookies = response.headers['set-cookie'];&lt;BR /&gt;//qsocks config, merges into standard https/http object headers.&lt;BR /&gt;//Set the session cookie correctly.&lt;BR /&gt;var config = {&lt;BR /&gt;host: 'Your Host', // your host Qlik Url&lt;BR /&gt;isSecure: true,&lt;BR /&gt;port: 443,&lt;BR /&gt;origin: 'http://localhost',&lt;BR /&gt;rejectUnauthorized: false,&lt;BR /&gt;headers: {&lt;BR /&gt;"Content-Type": "application/json",&lt;BR /&gt;"Cookie": cookies[0]&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;qsocks.Connect(config).then(function(global) {&lt;BR /&gt;global.openDoc("Put Your AppId").then(function(app){&lt;BR /&gt;app.getField("Country").then(function(field){&lt;BR /&gt;var selected=[&lt;BR /&gt;{&lt;BR /&gt;"qText": "Germany",&lt;BR /&gt;"qIsNumeric": false,&lt;BR /&gt;"qNumber": 0&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;field.selectValues(selected).then(function(selection){&lt;BR /&gt;console.log(selection);&lt;BR /&gt;});&lt;BR /&gt;//field.selectAll();&lt;BR /&gt;//field.clear();&lt;BR /&gt;})&lt;BR /&gt;})&lt;BR /&gt;})&lt;BR /&gt;})&lt;BR /&gt;})&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;check this out bro. if it will work for you&lt;/P&gt;&lt;P&gt;Thanks Regards&amp;nbsp;&lt;BR /&gt;Harsh Gohil&lt;/P&gt;</description>
      <pubDate>Sat, 30 Nov 2019 05:18:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/SelectValues-in-Realtime-using-enigma-js/m-p/1652822#M11906</guid>
      <dc:creator>iharsh220</dc:creator>
      <dc:date>2019-11-30T05:18:58Z</dc:date>
    </item>
  </channel>
</rss>

