Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
pamaxeed
Contributor 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

Tags (3)
1 Solution

Accepted Solutions
tsm
New Contributor III

Re: Extension - Custom Attributes for NxDimension

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)

3 Replies
tsm
New Contributor III

Re: Extension - Custom Attributes for NxDimension

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
Contributor III

Re: Extension - Custom Attributes for NxDimension

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
New Contributor III

Re: Extension - Custom Attributes for NxDimension

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

Community Browser