Qlik Sense

Qlik is Business Intelligence and Analytics tool for data based decision making. Qlik allows making presentations, dynamic chart and table creation and statistical analysis. Qlik can also be used as virtual database.

Features of Qlik:

  • With the help of direct discovery, Qlik allow users to perform Business discovery and visual analysis.

  • Mobile-ready, Roles, and Permissions.

  • Interactive dynamic apps and Dashboards.

Installation

Qlik Sense Desktop and Qlik Sense Cloud version is available for free, with Qlik account registration.

  1. To get Qlik Sense Desktop (Windows only) or Qlik Sense Cloud visit Qlik.com.

  2. Create a Qlik account.

  3. Installation link will be sent to your email.

  4. Open the email and follow the download guidelines.

  5. After download is complete, run the file and follow the installation guide.

  6. Once installation successfully completed you are ready to used your Qlik Sense application.

Examples

Below a few examples of working with Qlik in combination with inmation will be provided. The examples will be based on inmation demo data, to configure the demo data in your inmation environment, follow this guide.

Flat files

  1. DataStudio allows file export, right click on the selected object and choose add item(s) to History Grid. Select the desired period and History grid will be displayed on your screen.

  2. On the top left corner of the history grid, export button can be found (fourth button from the left), DataStudio supports CSV, Excel and JSON format export. Qlik supports all of these formats, however CSV is easiest to work with, go to → file → save as, ans save the file on your chosen location on the system.

  3. Open Qlik Sense application, click on My Computer tab, which is located on the left side of the screen. third icon from the top → choose the file and click on add data.

  4. You are ready to work with your data.

Web

Postman or Swagger and inmation Web API can be used to generate URL, which in turn can be used to import data from inmation DataStudio to Qlik Sense. Qlik Sense supports HTTP Get and Post methods.

  1. Generate URL using inmation Web API and Swagger or Postman applications.

  2. Open Qlik Sense application, click on the New tile, which is located on the left side of the screen. Choose REST.

  3. Paste URL, select Get or Post method, authentication method and click Create.

  4. The data is loaded and format is automatically recognized.

If you are new to inmation Web API, this section will help you to get up and running in no time here.

Web - Advanced Endpoint

Advanced Endpoints is a very powerful way to embed your corporate logic directly in the inmation Web API. Advanced Endpoint can be used for data export and Content-Type setting, for example to CSV instead of the usual JSON.

To create advanced endpoint for reading historical data go to DataStudio, select APIContext and click on Script Library which is located in the Object Properties tab on the right side of the screen. Add a new Script library by pressing the plus sign and name the library "my-lib". This simplified script example reads raw historical data of the process data item from the DemoData. Add this script to Lua Script Body section:

local inAPI = require('inmation.api')

local lib = {}

function lib.readhist(_, arg, req, hlp)
    arg = arg or {}
    local now = inmation.currenttime()
    local startTime
    if type(arg.starttime) == 'string' then
        -- Use starttime supplied by the caller
        startTime = arg.starttime
    else
        -- Fallback to a default relative starttime
        startTime = inmation.gettime(now-(5*60*1000))
    end
    local endTime = inmation.gettime(now)
    local qry = {
        start_time = startTime,
        end_time = endTime,
        items = {
            {
                p = "/System/Core/Examples/Demo Data/Process Data/DC4711"
            }
        }
    }

    local respData = {}
    local res = inAPI:readrawhistoricaldata(qry, req, hlp)
    local rawData = res.data or {}
    local histData = rawData.historical_data or {}
    local queryData = histData.query_data or {}
    if #queryData > 0 then
        queryData = queryData[1]
        local items = queryData.items or {}
        if #items > 0 then
            items = items[1]
            for i,t in ipairs(items.t) do
                local value = items.v[i]
                local timestampISO = inmation.gettime(t)
                local row = ("%s,%s"):format(timestampISO, value)
                table.insert(respData, row)
            end
        end
    end
    local result = table.concat(respData, '\n')
    return hlp:createResponse(result, nil, 200, { ["Content-Type"] = "text/csv" })
end

return lib

HTTP Get

Invoke the Lua script from Postman tool to test if everything is working. If your test was successful, go to your Qlik Sense application, choose New → REST, paste your URL → click ok. A preview tab should pop up, with your data transformed into data table.

Request URL
  • /api/v2/execfunction/my-lib/readhist

Response body
2019-07-23T07:39:00.041Z,16.824450683594
2019-07-23T07:39:30.041Z,16.898840332031
2019-07-23T07:40:00.041Z,17.029431152344
2019-07-23T07:40:30.041Z,17.212634277344
2019-07-23T07:41:00.041Z,17.340710449219
2019-07-23T07:41:30.041Z,17.212640380859
2019-07-23T07:42:00.041Z,17.141229248047
2019-07-23T07:42:30.041Z,17.09482421875
2019-07-23T07:43:00.041Z,17.226696777344
2019-07-23T07:43:30.041Z,17.072930908203

For more information about Advanced Endpoints visit Web API Advanced Endpoint.