Skip to content

Instantly share code, notes, and snippets.

@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,
@mindspank
mindspank / grid.js
Created October 26, 2015 20:45
Grid change
app.getObject( "THE SHEET ID" ).then(function(obj) {
// Patch some properties on the sheet.
// In this case replace the column and row properties with new values
obj.applyPatches([{
qPath: '/columns',
qOp: 'replace',
qValue: '200'
},{
qPath: '/rows',
qOp: 'replace',
@mindspank
mindspank / PickChartInEdit.js
Last active April 15, 2016 20:46
detect edit mode #extensionapi
define(['qvangular', 'qlik', 'jquery'],function(qvangular, qlik, $) {
var SUPPORTED_CHARTS = ['barchart', 'piechart', 'linechart', 'combochart']
return {
initialProperties : {
version: 1.0,
qHyperCubeDef : {
qDimensions : [],
qMeasures : [],