Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
sheldonqlik
Contributor II
Contributor II

Qliksense custom measure property for extension with expression value

I have created a custom property for a measure in my extension

CustomMeasureProp:{

          type:"string",

          label:"Custom Measure Property",

          ref:"customMeasureProperty",

          expression: "optional"

}

In the QlikSense Desktop I am able to add my extension and see the custom property when adding my measure.

I populate it with my EXPRESSION Max(value).

THE QUESTION.  

How do I access that evaluated expression through the api?

I have used my code

$scope.backendApi.getProperties().then(function(reply){

          angular.forEach(reply.qHyperCubeDef.qMeasures,function(measure){

           console.log('MEASURE',measure);

           if(typeof measure.customMeasureProperty!=='undefined'){

              console.log('MEASURE LABEL', measure.customMeasureProperty);

         }

});

Rather than returning the evaluated expression when looking  at the object measure.customMeasureProperty, it returns the string Max(value).

So how do get the evaluated value?

27 Replies
humesh_sindpure
Partner - Contributor III
Partner - Contributor III

colorExpression:{

  type: "string",

  label: "Enter color expression",

  ref:"qHyperCubeDef.qDimensions.0.qAttributeExpressions.0.qExpression",

  expression:"optional"

  }

how do I call   this ref: qHyperCubeDef.qDimensions.0.qAttributeExpressions.0.qExpression",  in function

jonvitale
Creator III
Creator III

I don't think that expression is valid. But I'm not sure.

It looks like you are trying to specify exactly where the evaluated expression will go within the HyperCube. But, Qlik is smart enough to put it where it is supposed to go as long as you use the correct format. As I mentioned in the post above yours, using, "qAttributeExpressions.0.qExpression" will put an evaluated expression in the HyerCube, but you'll have to go digging for it a bit (refer to my trace above).

But, maybe your expression will work, I don't know.

humesh_sindpure
Partner - Contributor III
Partner - Contributor III

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

jonvitale
Creator III
Creator III

humesh_sindpure
Partner - Contributor III
Partner - Contributor III

Hello Sir,

  My name is Humesh . I am developing an extention for table.I want to add custome color property to every dimentions and measures.

I found your this code :

colorExpression:{    

   type: "string", 

   label: "Enter color expression",          

ref:"qAttributeExpressions.0.qExpression",  

  expression:"optional"

}

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",

                                          component : "expression"

                                          ref:"qAttributeExpressions.0.qExpression"

                                         }

                 }

  },

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

to apply custome color reference to dimention

      paint: function ($element,layout) {

// what should I write here

          if ( !this.$scope.table ) {

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

           }

         return qlik.Promise.resolve();      

       }

please give me solution

jonvitale
Creator III
Creator III

Over here. You already asked this.

Re: Set color by expression in extension

humesh_sindpure
Partner - Contributor III
Partner - Contributor III

Yes Sir,

I am really Sorry for this.

but I am not getting any solution for this.

Can you share any example for custome color property to dimention or measure ...

jonvitale
Creator III
Creator III

I'm not exactly sure how to help you. Please refer to the other thread since I provided more information there.

Re: Set color by expression in extension

But, here is my full code where I use dimensions to evaluate color expressions:

https://github.com/jonvitale/SenseColorableSankey/blob/master/SenseColorableSankey.js