Skip to main content

Design

The Design blog is all about product and Qlik solutions, such as scripting, data modeling, visual design, extensions, best practices, and more!

Announcements
CUSTOMERS ONLY: Now accepting customer applications for the 2023 Luminary Program: SUBMIT NOW
Yianni_Ververis
Employee
Employee

In an earlier post, i have demonstrated how to connect to our app using Mashup API and displaying the objects on our webpage without much coding (https://community.qlik.com/blogs/qlikviewdesignblog/2015/05/22/creating-a-webpage-based-on-the-qlik-...).

In one of my projects‌‌, I had to create custom charts one of which is to compare two golf players versus one measure. That means that I had to have a chart with 2 lines, one for each player, compared hole by hole This kind of visualization does not exist yet in Qlik Sense so I decided to build everything with qSocks and the Engine API.

I think this is the best solution for custom projects like this, since the Engine API is faster and it is loading only raw data.



qSocks is a wrapper intended to make our life easier on communicating with the Engine.(QSocks - Engine API wrapper).

In this first tutorial, I will show you how to connect to your Qlik Sense server and get a list of the available apps with qSocks.



  • In your html header, add qSocks that you downloaded from the link above and your js file.


  <script src="js/qsocks.bundle.js"></script>

  <script src="js/index.js"></script>

  • In your index.js, or however you have named your js file, add the connection configuration.

var config = {

  host: 'yourserver.com',

  isSecure: true

};

  • Establish a connection with the server based on that configuration.

qsocks.Connect(config).then(function(global) {

  • Get the list of all available apps on the server.

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

  • If you want to view the available apps on your console, do a forEach loop on that docList.

docList.forEach(function(doc) {

  • Here is what the console will output if you do "console.log(doc)"

2015_07_17_11_24_10_PGA.png

Here is the full code:

var config = {

  host: 'yourserver.com',

  isSecure: true

};

function connect() {

  qsocks.Connect(config).then(function(global) {

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

            docList.forEach(function(doc) {

                 console.log(doc.qDocId)

            });

       });

  });

};

connect();

In the next tutorial I will show you how to use the app id (qDocId) to connect to the app and get the available objects to display

17 Comments