Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
pamaxeed
Partner - Creator III
Partner - Creator III

Extension - Custom Attributes for NxDimension

Hi,

we are developing our extension and we would like to define custom attributes on dimensions and measures.

We saw that we have the so called qAttributeExpression property for our NxDimension object, but we do not know how is the correct syntax for our definition file.

qAttributeExpression

List of attribute expressions.

Array of NxAttrExprDef

For the measure there exists the qAttributeExpressions Property on the NxMeasure object and it works fine as follow:

measures : {

  uses : "measures",

  min : 1,

  items: {

        Dummy: {

             type: "string",

             ref: "qAttributeExpressions.0.qExpression",

             label: "Low Error Value",

             expression: "always",

             defaultValue: ""

        }

  }

  },

We tried various version but neither of then works for the Dimension`!

i.e.

dimensions : {

  uses : "dimensions",

  min : 1,

  items: {

    Test: {

        type: "string",

        ref: "qAttributeExpression.0.qExpression",

        label: "test",

        expression: "always",

        defaultValue: ""

                      }

  }

  },

How is the approach for the dimensions, can somebody assist please.

We would like to progress with the development of the extension and we get stuck on this point!

Update 26.09.2016:

Attached an example of what we would like to achieve, based on the Qliksense standard table chart.
Here we have a row level custom attribute like text color on dimension level.

Thanks and regards,

Patric

1 Solution

Accepted Solutions
tsm
Employee
Employee

Hi there,

You are basically correct, except that it should be qAttributeExpressions (with the s at the end). The help seems to have this wrong.

The contents of that array is NxAttrExprDef: https://help.qlik.com/en-US/sense-developer/3.0/Subsystems/EngineAPI/Content/Structs/NxAttrExprDef.h...

Which can contain an simple expression or a libraryID.

so your end result should look something like:

"qAttributeExpressions": [{

  "qExpression": "Avg([Sales Cost Amount])"

  }],

That should work, but check the resulting dimensionDef if it doesn't.

Best,

Tobias

(Sense client dev)

View solution in original post

3 Replies
tsm
Employee
Employee

Hi there,

You are basically correct, except that it should be qAttributeExpressions (with the s at the end). The help seems to have this wrong.

The contents of that array is NxAttrExprDef: https://help.qlik.com/en-US/sense-developer/3.0/Subsystems/EngineAPI/Content/Structs/NxAttrExprDef.h...

Which can contain an simple expression or a libraryID.

so your end result should look something like:

"qAttributeExpressions": [{

  "qExpression": "Avg([Sales Cost Amount])"

  }],

That should work, but check the resulting dimensionDef if it doesn't.

Best,

Tobias

(Sense client dev)

pamaxeed
Partner - Creator III
Partner - Creator III
Author

Thanks Tobias in fact this is what Qlik support told me the last week.

Your answer is correct, there is a typo in the documentation.

Best,

Patric

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