Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
d_pranskus
Partner - Creator III
Partner - Creator 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
ErikWetterberg

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

d_pranskus
Partner - Creator III
Partner - Creator III
Author

Thanks, Erik

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

Thanks