Qlik Community

Qlik Sense Integration, Extensions, & APIs

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

chkiriti
New 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
erik_wetterberg
Honored Contributor

Re: APIs to retrieve expressions used for a measure

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

Erik Wetterberg
https://extendingqlik.upper88.com/
6 Replies
erik_wetterberg
Honored Contributor

Re: APIs to retrieve expressions used for a measure

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

Erik Wetterberg
https://extendingqlik.upper88.com/
chkiriti
New Contributor II

Re: APIs to retrieve expressions used for a measure

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

cheers!!

Kiriti

ajaykakkar93
Contributor

Re: APIs to retrieve expressions used for a measure

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

Regards & Thanks,
Ajay Kakkar
ajaykakkar93@gmail.com
erik_wetterberg
Honored Contributor

Re: APIs to retrieve expressions used for a measure

Hi,

For dimensions it would be something like:

qDimensionListDef: {

     qType: "dimension",

     qData: {

          qDim: "/qDim",

          qDimInfos: "/qDimInfos"

     }

}

Erik Wetterberg

Erik Wetterberg
https://extendingqlik.upper88.com/
ajaykakkar93
Contributor

Re: APIs to retrieve expressions used for a measure

Thanks Erik it worked

Regards & Thanks,
Ajay Kakkar
ajaykakkar93@gmail.com
tvaditya
New Contributor

Re: APIs to retrieve expressions used for a measure

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?

Community Browser