Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
_jespers_
Partner - Creator II
Partner - Creator II

Only get 6 out of many more selections with getList()

When I use getList() for SelectionObject I only get the first 6 selections, even though I have selected many more values.

I have tried changing the Initial Properties for ListObject to a much higher value, but that doesn't seem to do any difference.

Does anyone know what I need to add/change to the code for me to be able to fetch all values?

define( ["qlik", "text!./template.html"],
	function ( qlik, template ) {
		var app = qlik.currApp(this);

		return {
			template: template,
			support: {
				snapshot: false,
				export: false,
				exportData: false
			},
			initialProperties: {
				qListObjectDef: {
					qInitialDataFetch: [{
						qWidth: 1000000000,
						qHeight: 10000000000
					}]
				}
			},
			paint: function ($element, layout) {
				app.getList("SelectionObject", function(reply){
					console.log("reply", reply);
				});
				return qlik.Promise.resolve();
			},
			controller: ['$scope', function ( $scope ) {

			}]
		};

	} );

 

Labels (1)
  • API

1 Solution

Accepted Solutions
alex_colombo
Employee
Employee

Hi @_jespers_ , if you want to have all selected values from a field, the best approach is to create a ListBox object and then read data from it. For each value you will see if it's selected or not. If you don't change the sort order first values are the selected ones.

If your goal is to read all the selected values from multiple fields, you have to create multiple ListBoxes.

In this thread I've inserted an example of ListBox, let me know if this can help you

 

View solution in original post

4 Replies
ajaykakkar93
Specialist III
Specialist III

HI,
please try the below code

var selFieldValue  = 20; // change this to get more values of the filter
app.createGenericObject({
selection: {
qStringExpression: "='*'&GetCurrentSelections('\n *','* : ',', '," + selFieldValue + ")"
}
}, function(reply) {
selections = sheetname + "*Selections:* \n\n" + reply.selection;
console.log$("#selections_" + layoutid).html(selections);
});

Please mark the correct replies as Solution. Regards, ARK
Profile| GitHub|YouTube|Extension|Mashup|Qlik API|Qlik NPrinting

_jespers_
Partner - Creator II
Partner - Creator II
Author

Hello,

Thank you for your reply. I tested your solution and it gives me a string of all my selected values in return.

2022-11-11 10_33_14-.png

So in that sense it works!

But it must be a more elegant way of extracting all the values, so the values come as an object and not as a long string, that I then have to parse into objects. 

 

 

alex_colombo
Employee
Employee

Hi @_jespers_ , if you want to have all selected values from a field, the best approach is to create a ListBox object and then read data from it. For each value you will see if it's selected or not. If you don't change the sort order first values are the selected ones.

If your goal is to read all the selected values from multiple fields, you have to create multiple ListBoxes.

In this thread I've inserted an example of ListBox, let me know if this can help you

 

_jespers_
Partner - Creator II
Partner - Creator II
Author

That solution works perfectly! Thank you!