Skip to content

Instantly share code, notes, and snippets.

@mindspank
mindspank / hypercubesample.js
Last active January 18, 2022 04:13
HyperCube Sample #engineapi #qsocks
const qsocks = require('qsocks');
qsocks.Connect({
host: 'branch.qlik.com',
prefix: 'anon',
isSecure: true
})
.then(function(global) {
return global.openDoc('3f3a866b-238f-4d1a-8aeb-81e97756af7a')
})
const request = require('request');
const qsocks = require('qsocks');
const fs = require('fs');
// Qlik Sense App ids
const appIds = ['efdf4130-7b89-45f6-8639-179666f3e35c',
'87c2d436-b9b0-4414-8fa1-f5289627b34e',
'b0d3a00d-798b-4e34-8e7c-ab06caa54567',
'69a8c183-8bc7-4aa4-8ad1-192dbf4d60f8',
'1158e903-446f-4092-bed1-beb748a209b3',
@mindspank
mindspank / createmeasure.js
Created February 2, 2016 21:24
Creates a measure on the server
const qsocks = require('qsocks');
const fs = require('fs');
/**
* Creating a master measure in Qlik Sense Desktop
*/
const config = {
host: 'usrad-aklprobook',
isSecure: true,
rejectUnauthorized: false,
@mindspank
mindspank / reloadallapps.js
Created January 29, 2016 16:47
reload apps in desktop
// Using Bluebird to help us with async flow control
const Promise = require('bluebird');
// Qsocks is used to help with Engine API comminication
const qsocks = require('qsocks');
// Connecting to Qlik Sense Desktop
qsocks.Connect().then(function(global) {
define( ["jquery"], function ( $ ) {
'use strict';
return {
initialProperties: {
qHyperCubeDef: {
qDimensions: [{
qDef: {
qFieldDefs: ['Dim1'],
qFieldLabels: ['']
@mindspank
mindspank / createmeasure.js
Created January 21, 2016 18:10
CreateMeasure with qsocks
const qsocks = require('qsocks');
/**
* Creating a master measure in Qlik Sense Desktop
*/
qsocks.Connect().then(function(global) {
// Open a document
global.openDoc('TestScript').then(function(app) {
@mindspank
mindspank / require url.js
Last active April 15, 2016 20:39
url to require url #extension
define( ["require"], function ( localRequire ) {
var path = localRequire.toUrl( "extensions/d3-vis-library/d3-vis-library.css" );
});
@mindspank
mindspank / loopapps.js
Created December 2, 2015 01:29
loop apps with qsocks
var qsocks = require('qsocks');
var Promise = require('bluebird');
qsocks.Connect()
.then(function(global) {
return global.getDocList();
})
.then(function(doclist) {
//Map over doclist, limit to 3 connection at a time to not choke the available sockets
@mindspank
mindspank / refresh.ps1
Last active November 22, 2015 20:07
A short powershell script that will refresh cached Qlik Sense charts using chartcacher https://github.com/mindspank/chartcacher
$qlikserver = "https://<qliksensehostname>:1337/"
$nocache = '/nocache'
$urls = $("24cc3e5a-622b-4267-97e0-38851090f5a7/JEBdZz", "24cc3e5a-622b-4267-97e0-38851090f5a7/ARNmpdM", "24cc3e5a-622b-4267-97e0-38851090f5a7/BmfQbz")
foreach($url in $urls) {
Invoke-RestMethod "$qlikserver$url$nocache"
}
@mindspank
mindspank / list.js
Created November 6, 2015 14:21
Listbox always sorted numerical
define(['jquery'], function($) {
return {
initialProperties: {
qListObjectDef: {
qDef: {
qFieldDefs: [
'[Fiscal Year]'
],
qSortCriterias: [{
qSortByNumeric: -1,