Created
August 11, 2015 15:11
-
-
Save mindspank/e2bb2c30bd54e7bec9de to your computer and use it in GitHub Desktop.
This file contains 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
// Create a Generic Object that contains multiple generic objects. | |
var qsocks = require('qsocks'); | |
//Connect to Qlik Sense Desktop | |
qsocks.Connect().then(function(global) { | |
//Open document Sales Discovery | |
global.openDoc('Sales Discovery.qvf').then(function(app) { | |
//Define our listbox definition. | |
//Optional parameters has been omitted | |
//Refer to documentation for a full list of properties | |
//https://help.qlik.com/sense/en-us/developer/Subsystems/EngineAPI/Content/GenericObject/PropertyLevel/ListObjectDef.htm | |
var obj = { | |
"qInfo": { | |
"qId": "CB01", | |
"qType": "Combo" | |
}, | |
"ListObject1": { | |
"qListObjectDef": { | |
"qDef": { | |
"qFieldDefs": [ | |
"Month" | |
], | |
"qFieldLabels": [ | |
"Month" | |
], | |
"qSortCriterias": [{ | |
"qSortByExpression": -1, | |
"qExpression": { | |
"qv": "=sum([Sales Amount])" | |
} | |
}] | |
}, | |
"qInitialDataFetch": [{ | |
"qTop": 0, | |
"qLeft": 0, | |
"qHeight": 100, | |
"qWidth": 2 | |
}], | |
"qExpressions": [{ | |
"qExpr": "=sum([Sales Amount])" | |
}] | |
} | |
}, | |
"ListObject2": { | |
"qListObjectDef": { | |
"qDef": { | |
"qFieldDefs": [ | |
"City" | |
], | |
"qFieldLabels": [ | |
"City" | |
], | |
"qSortCriterias": [{ | |
"qSortByAscii": -1, | |
"qExpression": {} | |
}] | |
}, | |
"qInitialDataFetch": [{ | |
"qTop": 0, | |
"qLeft": 0, | |
"qHeight": 100, | |
"qWidth": 1 | |
}] | |
} | |
} | |
}; | |
//Create the generic object as a session object which will persist over the session and then be deleted. | |
app.createSessionObject(obj).then(function(list) { | |
//Object has been created and handle returned. | |
//Get the layout of the object which will contain two list objects. | |
list.getLayout().then(function(layout) { | |
//Layout, model and data is retured. | |
console.log(layout) | |
}) | |
}) | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment