3 Replies Latest reply: Mar 23, 2018 12:50 AM by Humeshkumar Sindpure RSS

    Qlik Sense custom property on Dimension or Measure

    Alan Green

      Are there any examples out there which show how to sue custom properties in a Qlik Sense Extension for eitehr a measure or dimension.

       

      For example I would like a toggle on each measure - On or off and then be able to read the setting for each measure.

       

      I have been able to create the toggle in the accordion and set it, but I do not know how to read the value.

        • Re: Qlik Sense custom property on Dimension or Measure
          Stefan Walther

          Hi,

           

          I am not 100% sure if I get your requirements correctly - I assume that your other post (Custom property in Qlik Sense extension) is related to the same requirement, right?

           

          So what exactly are you trying to achieve?

           

          Regards

          Stefan

            • Re: Qlik Sense custom property on Dimension or Measure
              Alan Green

              Hi Stefan

               

              Yes it is related to my other post as well.

               

              I have started to create an extension which is a heatmap table.(Similar to conditional formatting in Excel)

               

              I have created an extension which applies the condition to all measures. I am trying to make this more customisable for each measure.

               

              For example I want to be able to set each measures "Colour using Heatmap" to on or off. If On I then want to set the value of maximum.

               

              I have added the following code :

              measures : {

                                                                                              uses : "measures",

                                                                                              min : 0,

                                                                                         

                                                                                              items: {

                                                                                              MySwitchProp: {

                                                                                                              type: "boolean",

                                                                                                              component: "switch",

                                                                                                              label: "Colour using Heatmap",

                                                                                                              ref: "MySwitchProp",

                                                                                                              options: [{

                                                                                                                              value: true,

                                                                                                                              label: "On"

                                                                                                              },

                                                                                                              {

                                                                                                                              value: false,

                                                                                                                              label: "Off"

                                                                                                              }],

                                                                                                              defaultValue: false

                                                                                              },

                                                                                              MyNumProp: {

                                                                                                              type: "number",

                                                                                                              label: "Maximum",

                                                                                                              ref: "myproperties.max",

                                                                                                              defaultValue: "10.5",

                                                                                                              show : function(data) {

                                                                                                                                              return data.MySwitchProp;

                                                                                                                              }

                                                                                              }

                                                                              }

                                                         

                                                                              }

               

              Using the above I can now set the maximum for each measure through the accordion.

               

              I am now trying to see how I capture the values.

               

              I am trying to see the values for each measure of MySwitchProp and MyNumProp. Does this get returned to the layout object?

               

              If so how is this done and where can I view the results?

               

              Regards


              Alan

               

              ----------------------

              Update

              ----------------------

               

              I have found that myproperties are stored in qHyperCubDef. What is the best way to read this and get the values?

                • Re: Qlik Sense custom property on Dimension or Measure
                  Humeshkumar Sindpure

                  Hello Sir,

                  I want to add Custome coloe property to dimention.

                   

                   

                  I have written this code inside of dimention shown below:

                   

                  definition : {

                    type : "items",

                    component : "accordion",

                      items : {

                           dimensions : {

                                  uses : "dimensions",

                                  min : 1,

                                  items: {

                                 colorExpression:{

                                                            type: "string",

                                                            label: "Enter color expression",

                                                            ref:"qAttributeExpressions.0.qExpression",

                                                            expression:"optional"

                                                           }

                   

                                   }

                    },

                  now please tell me what should I need to write inside of function

                   

                        paint: function ($element,layout) {

                   

                   

                   

                                        this.backendApi.eachDataRow( function (rownum, row){

                                            var dimIndex = 0; // you are putting the value in your first dimension

                                             row[dimIndex].qAttrExps.qValues[0].qText;

                                        });

                   

                                                if ( !this.$scope.table ) {

                                                this.$scope.table = qlik.table(this);

                   

                                                       }

                   

                                             return qlik.Promise.resolve();

                   

                                 }

                  but Sir , this is not working for me.

                  please give me any solution