Skip to content

Instantly share code, notes, and snippets.

@theredpea
Last active April 23, 2018 21:48
Show Gist options
  • Save theredpea/d85cdaf3d6d45e780b95803c89c659c5 to your computer and use it in GitHub Desktop.
Save theredpea/d85cdaf3d6d45e780b95803c89c659c5 to your computer and use it in GitHub Desktop.
const LIST_LIMIT = 10000;
const FIELD_TO_LIST = 'field_name';
//createListObject({
qlik.currApp().model.enigmaModel.createSessionObject({
"qInfo": {
"qType": "listbox"
},
"qListObjectDef": {
"qDef": {
"qFieldLabels": [
FIELD_TO_LIST
],
"qFieldDefs": [
FIELD_TO_LIST
],
"autoSort": true,
"cId": "",
"qSortCriterias": [
{
//This part is important, qSortByState:
//Could also use qAutoSortByState
// (type: NxAutoSortByStateDef)
//https://help.qlik.com/en-US/sense-developer/September2017/Subsystems/EngineAPI/Content/GenericObject/PropertyLevel/ListObjectDef.htm
"qSortByState": 1,
"qSortByAscii": 1,
"qSortByNumeric": 1,
"qSortByLoadOrder": 1
}
]
},
"qLibraryId": "",
"qShowAlternatives": true,
"qInitialDataFetch": [
{
"qTop": 0,
"qLeft": 0,
"qWidth": 0,
"qHeight": 0
}
]
}
})
.then(_=>_.getListObjectData('/qListObjectDef', [{qTop:0, qLeft: 0 , qHeight: LIST_LIMIT, qWidth: 1}]))
.then(listObject=>listObject[0].qMatrix.filter(qMatrixRow=>['S','L'].indexOf(qMatrixRow[0].qState)>-1))
.then(selected=>console.log(selected))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment