Qlik Community

Qlik Sense Integration, Extensions, & APIs

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

d_pranskus
Contributor III

Accessing QlikSense Extension properties from measure definition

Hi Qlik Experts

I am developing a QlikSense extention and would like to access it's property values from the measure definition. Is it possible? I am able to get the values in the same sesction, but how to do this from different section? Also would it be possible to get Qliks internal object id from the definition?

Many thanks

{

    type: "items",

    component: "accordion",

    items: {

        measures: {

            uses: "measures",

            min: 1,

            items: {

                customProperty: {

                    ref: "qDef.customProperty";

                    label: "Custom Measure Property",

                    type: "string",

                    defaultValue: function() {

                        // I would like to access extention object property "objectId" value defined in appearance/layout section

                       return "some initial value";

                    },

                    expression: "optional"

                }

            }

        },

        appearance: {

            uses: "settings",

            items: {

                layout: {

                    type: "items",

                    label: "Layout",

                    items: {

                        objectId: {

                            type: "string",

                            label: "Object Id",

                            ref: "qDef.objectId",

                            defaultValue: function() {

                                objectId = helpers.makeId(8); // use some helper function to generate a random id

                                return objectId;

                            },

                        }

                    }

                }

            }

        }

    }

}

3 Replies
erik_wetterberg
Valued Contributor III

Re: Accessing QlikSense Extension properties from measure definition

Hi Darius,

This might be complicated... You do not get any parameters in the defaultValue call (at least not in 3.2) and this only points to your own object. You might try to save a reference somewhere and use that (perhaps in the paint method, check if you are in edit mode, then save what you want in a var, use it in defaultValue function).

Another option I have used is to not set any default value and then instead set it in paint:

var myprop = layout.myprop || calcDefault(layout);

Hope this helps

Erik Wetterberg

Erik Wetterberg
https://extendingqlik.upper88.com/
d_pranskus
Contributor III

Re: Accessing QlikSense Extension properties from measure definition

Thanks, Erik

Could you please advice, how can I check if I am in edit mode?

Thanks

erik_wetterberg
Valued Contributor III

Re: Accessing QlikSense Extension properties from measure definition

Hi,

Try this: getMode method ‒ Qlik Sense

Erik Wetterberg

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