Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

alan_grn
Contributor

Qlik Sense custom property on Dimension or Measure

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.

3 Replies
Employee
Employee

Re: Qlik Sense custom property on Dimension or Measure

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

alan_grn
Contributor

Re: Qlik Sense custom property on Dimension or Measure

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?

humesh_sindpure
New Contributor II

Re: Qlik Sense custom property on Dimension or Measure

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