How can i get a Qlik app layout as XML/JSON File?

38 views Asked by At

What is the simplest way to view the structure/layout of my Qlik dashboards in the form of XML or JSON files in Qlik Sense Desktop? So it should contain detailed informaions about visualizations & styles.

Is building a (Python) script to access information via the Qlik Engine JSON API the right approach?

Update 1 current Code

(async () => {
  const { docMixin } = await import("enigma-mixin");
  const fs = require('fs');
  const enigma = require('enigma.js');
  const WebSocket = require('ws');
  const schema = require('enigma.js/schemas/12.612.0.json');

  // create a new session:
  const session = enigma.create({
      schema,
      mixins: [docMixin],
      url: 'ws://localhost:9076/app/engineData',
      createSocket: url => new WebSocket(url),
  });

  async function run() {
      const global = await session.open()

      // change to your appId
      const doc = await global.openDoc("My_App")

      const entities = await doc.mUnbuild()

      await session.close()
  }

  await run();
})();

Output

const entities = await doc.mUnbuild()
                                 
TypeError: doc.mUnbuild is not a function
1

There are 1 answers

4
Stefan Stoichev On BEST ANSWER

For QlikSense:

  • qlik-cli - Qlik have a command line tool that can unbuild the app into its components and saves them into json and yaml files
  • enigma-mixin - i've wrote an enigma.js mixin that can be used from JS project to also "unbuild" an app into its components. Be aware that its not heavily tested
  • Engine JSON API - the above solutions are using the Engine APIs to achieve its goals. So if you want something more specific then you'll have to use these APIs. The Engine APIs is the official (and only?) way to communicate with an app. This API can be used with any language that supports websockets

For QlikView:

Tthis functionality exists into QV itself. Have a look at this tutorial how to create xml files with the app components

Update - Adding enigma-mixin example

import fs from "fs"
import WebSocket from "ws";
import enigma from "enigma.js";
import { docMixin } from "enigma-mixin";

const schema = JSON.parse(fs.readFileSync("./node_modules/enigma.js/schemas/12.612.0.json"));

const session = enigma.create({
    schema,
    mixins: [...docMixin],
    url: "ws://127.0.0.1:4848/app/engineData",
    createSocket: (url) => new WebSocket(url),
});

async function run() {
    const global = await session.open()

    // change to your appId
    const doc = await global.openDoc("SOME-APP-ID-HERE")

    const entities = await doc.mUnbuild()

    await session.close()
}

run()

In the script above enities variable will have the following content:

mUnbuild result