Skip to content

Instantly share code, notes, and snippets.

@mindspank
mindspank / dimensionlimits
Last active April 15, 2016 20:44
Creates a hypercube with dimensionlimits #capabilitiesapi
app.createCube({
qDimensions: [{
qDef: {
qFieldDefs: ["Sales Rep Name"]
},
qShowTotal: false,
qOtherTotalSpec: {
qOtherMode: 'OTHER_COUNTED',
qOtherCounted: {
// Sets the number to limit by
@mindspank
mindspank / dataconnectionqrs.js
Last active April 15, 2016 20:44
Update dataconnection #qrs
var https = require('https');
var fs = require('fs');
var options = {
rejectUnauthorized: false,
hostname: <QRS HOST NAME>,
port: 4242,
path: '/qrs/dataconnection/18a67b3a-2228-4c06-9e38-c9cb9900288c?xrfkey=abcdefghijklmnop',
method: 'PUT',
headers: {
@mindspank
mindspank / QMC - Hidden Stream Access Rule
Created October 24, 2014 17:46
Give access to apps and objects that are placed in a hidden stream
Resource filters: App*,App_*
Conditions: ((resource.resourcetype = "App" and resource.stream.name="<Your Stream Name>")) or ((resource.resourcetype = "App.Object" and resource.published ="true"))
@mindspank
mindspank / qsocks.node.connectlocal.js
Last active September 20, 2015 17:01
qsocks - sample
//Require the module
var qsocks = require('qsocks');
//For Qlik Sense Desktop
//You have two different entry points, the global handle or connect directly to an app.
//The entire Engine API is async and managed through promises in this module.
//Global
//Connecting to the Engine, once connected returns the handle for global.
@mindspank
mindspank / DoReload
Last active December 9, 2016 10:07
Reload app using mashup api in a extension
define(['js/qlik', 'jquery'], function(qlik, $, $element) {
var id = 2;
return {
paint: function($element) {
var app = qlik.currApp();
$element.html("<button id='reload'>Reload</button>")
var request = require('request');
var Promise = require("es6-promise").Promise
var fs = require('fs');
var certs = require('./certs');
module.exports = function() {
var r = request.defaults({
rejectUnauthorized: false,
key: certs.key,
@mindspank
mindspank / gist:fad79afb8e6daa283c5e
Created February 5, 2015 20:08
Move around labels d3js
function arrangeLabels() {
var move = 1;
while (move > 0) {
move = 0;
svg.selectAll(".place-label")
.each(function() {
var that = this,
a = this.getBoundingClientRect();
svg.selectAll(".place-label")
.each(function() {
@mindspank
mindspank / qsocks.node.connect.js
Last active October 23, 2017 09:15
Very verbose example on how to connect qsocks to a server.
var qsocks = require('qsocks');
var fs = require('fs');
var request = require('request');
//Set our request defaults, ignore unauthorized cert warnings as default QS certs are self-signed.
var r = request.defaults({
rejectUnauthorized: false,
host: 'usrad-akl.qliktech.com',
pfx: fs.readFileSync("C:\\QlikTech\\Demo Team\\Node\\qsocks\\client.pfx")
})
@mindspank
mindspank / qsocks.listbox.sort.js
Created March 21, 2015 17:13
Create a listbox with qsocks, sorted by expression and including a expression
/*
* Create a listobject, sort by a expression and include a expression.
* Tested on QIX Engine API 1.1
* Alexander Karlsson - http://github.com/mindspank - akl@qlik.com
*/
//Your server you want to connect to.
var config = {
host: 'sense-demo.qlik.com',
@mindspank
mindspank / gist:c435dd3c9253897bbc2f
Created April 2, 2015 22:18
Save console output to file
(function(console){
console.save = function(data, filename){
if(!data) {
console.error('Console.save: No data')
return;
}
if(!filename) filename = 'console.json'