Created
January 21, 2016 18:10
-
-
Save mindspank/9aafa9cb9bd4ff0b3fbc to your computer and use it in GitHub Desktop.
CreateMeasure with qsocks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { | |
// Creating a measure in the master library | |
// See this article for the request structure | |
// http://help.qlik.com/sense/2.1/en-us/developer/Subsystems/EngineAPI/Content/Classes/AppClass/App-class-CreateMeasure-method.htm | |
app.createMeasure({ | |
qInfo: { | |
qId: '', | |
qType: 'measure' | |
}, | |
qMeasure: { | |
qLabel: 'This is a measure created with the Engine API', | |
qDef: '=Sum(Expression1)' | |
}, | |
qMetaDef: { | |
title: 'This is a measure created with the Engine API', // Yes this is annoying | |
description: 'A description' | |
} | |
}) | |
.then(function() { | |
// Persist changes to disk. | |
return app.doSave(); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment