Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
jenriquez
Contributor III
Contributor III

How to display all selected values in created custom extensions

I'm new to QlikSense and can't figure out the right syntax to get the all selected values in extensions. 

Below is my code of extensions.

 

define( ['qlik', 'jquery', 'css!./select_field.css'],
	function (qlik, $) {
		return {
			paint: function ($element) {
				var app = qlik.currApp();
				app.getList("CurrentSelections", function(reply) {
					
				var mySelectedFields = reply.qSelectionObject.qSelections;
				//console.log(mySelectedFields);
				
				if (mySelectedFields.qLocked == true)
				{
					icon = 'unlock'
				}
				else
				{
					icon = 'lock';
				}
				
				var html = '<div class="bgShowSelection">';
				
				if (mySelectedFields.qLocked == true)
				{
					html += '<button id="lock_button" class="btn-lock-unlock"><p class="lui-icon lui-icon--lock"></p></button>'
				}
				else
				{
					html += '<button id="unlock_button" class="btn-lock-unlock"><p class="lui-icon lui-icon--unlock"></p></button>'
					html += '<button id="clearAll" class="btn-lock-unlock"><p class="lui-icon lui-icon--clear-selections"></p></button>';
				}
			
				//loop through selected fields
				var mySelectedFields_arrayLength = mySelectedFields.length;
				
				for (var i = 0; i < mySelectedFields_arrayLength; i++) {
				//console.log(mySelectedFields[i].qSelected);
					
					//loop through selected field values
					var currentFieldValues = mySelectedFields[i].qSelectedFieldSelectionInfo
					var currentFieldValues_arrayLength = currentFieldValues.length;
					
					if (mySelectedFields.qLocked == true)
					{
						lockUnlock = 'bgShowSelectionsLock'
					}
					else
					{
						lockUnlock = 'bgShowSelectionsUnlock';
					}
					
					for (var y = 0; y < currentFieldValues_arrayLength; y++)
					{
						html += '<span id="selectedvalue" class="no_selected '+lockUnlock+'" title="'+mySelectedFields[i].qField+'">'+currentFieldValues[y].qName+'<input type="submit" value="x" class="btndelete" style="font-size : 10px;"/></span>';
					}
				}
				html += '</div>';
				$element.html(html);
			});
			return qlik.Promise.resolve();
			}
		};
	}
);

 

 

I can select the value here in my code but it only display maximum of 6 values per filter pane.

Sample of my extensions below, I select more than 6 values on report period filter but on my extension it only display 6 values, can some one help me to display all selected.

 

Can anybody help me with the right code syntax?

Labels (2)
9 Replies
Manoj_Prabu
Partner - Creator
Partner - Creator

Hi @jenriquez ,

I'm also new to Qlik sense but i think you need to set qInitialproperties and qInitialDataFetch. Refer the link below, you need to set qWidth and qHeight.

https://help.qlik.com/en-US/sense-developer/September2020/Subsystems/APIs/Content/Sense_ClientAPIs/E... 

ArnadoSandoval
Specialist II
Specialist II

Hi @jenriquez 

I tried your extension code (after commenting out your css file) and it was showing me a maximum of 6 selections per field, after that it switched to a different way to show the selection, I added the following console.log to your code:

ShowValues-01.png

Then I found a reference to qSelectionThreshold in the  qFieldSelections Qlik Help document, also this community topic speaks about the Selection Threshold Sense extensions : How can I change qSelectionThreshold value ? ; I tried configuration suggested in my Setting.ini file, and it works!

ShowValues-02.png

It works, but I suspect it might not be enough for your proyect.

Hope this helps,

Arnaldo Sandoval
A journey of a thousand miles begins with a single step.
jenriquez
Contributor III
Contributor III
Author

Hi @ArnadoSandoval 

yup, its not enough for the requirements of my project, thanks by the way. 😊

jenriquez
Contributor III
Contributor III
Author

hi @Manoj_Prabu 

hmmm, still getting 6 values even I set qInitialproperties  and qInitialDataFetch.

var initialParameters = {'qWidth':1, 'qHeight':10000};
		return {
			support : {
				snapshot: true,
				export: true,
				exportData : false
			},
			initialProperties: {
				qListObjectDef: {
					qInitialDataFetch: [{
						qWidth: initialParameters['qWidth'],
						qHeight: initialParameters['qHeight']
					}]
				},
			},
jenriquez
Contributor III
Contributor III
Author

hi can somebody help me with the right code syntax to get all the selected values with no maximum limit? thanks in advance.

Manoj_Prabu
Partner - Creator
Partner - Creator

Hi @jenriquez ,

Did you tried with HyperCube? like below...

initialProperties : {

     qHyperCubeDef : {

          qDimensions : [],

          qMeasures : [],

          qInitialDataFetch : [{

               qWidth : 2,

              qHeight : 50

        }]

    }

}

jenriquez
Contributor III
Contributor III
Author

hi @Manoj_Prabu 

yup, I also tried the HyperCube. But still cant work to display all the selected values

jenriquez_0-1605095494561.png

 

Manoj_Prabu
Partner - Creator
Partner - Creator

Hi @jenriquez ,

I couldn't able to find whats the problem. but also check this.

Screenshot (149)_LI.jpg

in 1st I selected only 2 values in city field, so i get only 2 trellis chart even though i gave 10 in fixed number.

Screenshot (150).png

In 2nd i chose 4 value so it showing 4 trellis chart.

Screenshot (151)_LI.jpg

in the last i chose 4 city but i give only 3 in the fixed number(which act as initialfetchdata). so im getting 3 trellis chart.

may be you check other fields like city in your app that you chose only 6 field values (or 6 cities).

Thank you.

jenriquez
Contributor III
Contributor III
Author

hi @Manoj_Prabu 

can you share your extension? TIA.