4 Replies Latest reply: Aug 31, 2016 6:58 PM by Alex Watts RSS

    Sense extensions : How can I change qSelectionThreshold value ?

      Hi everybody,

       

      I'm new in the Qlik world, I want to work in Sense extensions and I've a question. It is probably a stupid question for you but I haven't again catch the overall vision of the development.

       

      To learn quickly, I force myself to do specific use cases and detailled. In this view, my first target is to understand the selection and how to change its configuration.

       

      This is my current code :

       

           define(["jquery", "text!./Log-CheckSelection.css", "qlik"], function ($, cssContent, qlik) {

               'use strict';

                $("<style>").html(cssContent).appendTo("head");

                return {

                     initialProperties : {

                          version: 1.0,

                          qHyperCubeDef : {

                               qDimensions : [],

                               qMeasures : [],

                               qInitialDataFetch : [{

                                    qWidth : 10,

                                    qHeight : 50

                               }]

                          }

                     },

                     definition : {

                          type : "items",

                          component : "accordion",

                          items : {

                               dimensions : {

                                    uses : "dimensions",

                                    min : 0,

                                    max : 0

                               },

                               measures : {

                                    uses : "measures",

                                    min : 0,

                                    max : 0

                               }

                          }

                     },

                     snapshot : {

                          canTakeSnapshot : true

                     },

                     paint : function($element) {

                          var app = qlik.currApp(this);

                          app.getList("CurrentSelections", function(reply) {

                               var html = "<h1>Selection Logs</h1>";

                               var mySelectedFields = reply.qSelectionObject.qSelections;

                               var mySelectedFieldsLength = mySelectedFields.length;

                               console.log(mySelectedFields);

                              

                               for(var value in mySelectedFields){

                                    html += "<h2>"+value.qField+"</h2>";

                                    console.log(value);

                                    for(var valueIn in value.qSelectedFieldSelectionInfo){

                                         html += "<p> - "+valueIn.qName+"<p>";

                                    }

                               }

                              

                               console.log(html);

                               $element.html(html);

                           });

                     }

                };

           });

       

      Above 6 selected values, my display list stops writing data. In the Dev Tool, tab Console I see the object (in my logs) and in I see that the qSelectionThreshold = 6, the default value. I understand that I must to change this value before my paint function. My problem is : "Where and How ?"

       

      I want the maximum of my selection on the object, is there max recommandation ?

      Is there a "infinite" value to insert in the qSelectionThreshold?

      Is it the good parameter to change ?

       

      Instinctively, I would say it is to change in initialProperties but I don't know the hierarchy to apply.

       

      Great thanks to your help.

        • Re: Sense extensions : How can I change qSelectionThreshold value ?

          Seriously !

          No one knows how to do or no one wants to help me ?

          I cannot think that's not workable... any help by a qlik dev ?

          I know it's a small question, but it's to completely understand and make customizable extensions.

          I've now 123 views of this topic, so potentially 123 people who have the same question...

           

          Thanks.

          • Re: Sense extensions : How can I change qSelectionThreshold value ?
            Anders Nilsson

            Hey Julie

             

            I tried your code and it didn't work as I expected.

            First you need to get your javascript for-loops right ... C# loops doesn't work.

             

            if you try this script your extension should at least work satisfying.

             

            define( [

                "jquery",

                "text!./Log-CheckSelections.css",

                "qlik"

            ], function (

              $,

              cssContent,

              qlik

            ) {

                 'use strict';

                 $("<style>").html(cssContent).appendTo("head");

                 return {

                      paint : function( $element ) {

                           var app = qlik.currApp( this );

                           app.getList( "CurrentSelections", function( reply ) {

                                var html = "<h1>Selection Logs</h1>";

                                var mySelectedFields = reply.qSelectionObject.qSelections;

                                mySelectedFields.forEach( function (value ) {

                                     html += "<h2>"+value.qField+"</h2>";

                                     value.qSelectedFieldSelectionInfo.forEach( function( valueIn ) {

                                          html += "<p> - "+valueIn.qName+"<p>";

                                     } );

                             } )

                             $element.html(html);

                        });

                   }

                 };

            });


            About changing the qSelectionThreshold value you will need to change a user setting. Unfortunately we don't expose any user settings in QlikSense yet (on the roadmap). But there is a way to change it if you're running Desktop.


            Close your desktop application and browse to your Sense Folder. Typically in "C:\Users\UserName\Documents\Qlik\Sense"

            There you will hopefully find a settings.ini file. Open that in a text editor (notepad) and insert the following line:

             

            MaxCurSelEntries=15

             

            somewhere under the [Settings7] - section. If you add the line last in the file you have to make sure there is an empty newline last in the file under your entry.

             

            Restart QlikSense Desktop. Now your qSelectionThreshold should be 15. Change it to what you want, but keep in mind that if you have a very high number you will send unnecessarily big amount of data to the javascript code in some situations and your application will not be responding very well.