Qlik Community

Ask a Question

Qlik Sense Integration, Extensions, & APIs

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

Announcements
Qlik Users, make your voice heard! Participate in Wisdom of Crowds® Market Study: Start Survey
cancel
Showing results for 
Search instead for 
Did you mean: 
chkiriti
Contributor II
Contributor II

APIs to retrieve expressions used for a measure

Hi,

Using the Qlik engine APIs, I am able to retrieve list of measures used in an application from my web app, but I can't find anything to also get the expressions used for measures.

Any help in this regard is appreciable.

Thanks in advance

1 Solution

Accepted Solutions
ErikWetterberg

Hi,

In your definition of the Measurelist you need to say what data you want to get for each measure by defining qData.

In the capabilities API you can do like this:

app.createGenericObject({

                qInfo: {

                    qType: "MeasureList"

                },

                qMeasureListDef: {

                    qType: "measure",

                    qData: {

                        qMeasure: "/qMeasure"

                    }

                }

            }, setData);

Hope this helps

Erik Wetterberg

View solution in original post

6 Replies
ErikWetterberg

Hi,

In your definition of the Measurelist you need to say what data you want to get for each measure by defining qData.

In the capabilities API you can do like this:

app.createGenericObject({

                qInfo: {

                    qType: "MeasureList"

                },

                qMeasureListDef: {

                    qType: "measure",

                    qData: {

                        qMeasure: "/qMeasure"

                    }

                }

            }, setData);

Hope this helps

Erik Wetterberg

View solution in original post

chkiriti
Contributor II
Contributor II

Thanks a lot Erik. I came back from vacation and checked it, it is absolutely working fine.

cheers!!

Kiriti

ajaykakkar93
Specialist
Specialist

can we do that for Dimension as well , can you give an example

ErikWetterberg

Hi,

For dimensions it would be something like:

qDimensionListDef: {

     qType: "dimension",

     qData: {

          qDim: "/qDim",

          qDimInfos: "/qDimInfos"

     }

}

Erik Wetterberg

ajaykakkar93
Specialist
Specialist

Thanks Erik it worked

tvaditya
Contributor
Contributor

Hi I would like to understand what this setData does?

I am creating the request this way:

  app.createSessionObject({

  qInfo: {

  qId: 'mysessionobject',

  qType: 'list'

  },


  qMeasureListDef : {

  qType: "measure", qData: { title: "/title", tags: "/tags", measure: "/qMeasure"  },

  qInitialDataFetch: [{

  "method": "GetLayout",

  "handle": 2,

  "params": [],

  "outKey": -1,

  "id": 4

  }]

  }

And printing it out to the console like this:

  myObject.forEach(element =>{

  console.log(element.qMeta.title + ' : ' + element.qMeta.description + ' : ' + element.qData.measure);

  console.log()

  });

What returns to my console is this:

Sales : Sum of sales amount. : [object Object]


So qMeasure is not returning the expression you know how this can be fixed?