Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Domski74
Contributor II
Contributor II

Qlik Sense Extension custom measure property Show / Hide

Hi All

I'm adding 2 custom properties on measures but I only want to display the second property based on the selection in the first, I have used show in appearance properties passing in data but not sure how I'd do that in measure custom properties, here is my code so far that works when you comment the show part:

measures: {
uses: "measures",
min: 1,
max: 10,
items: {
measuretype: {
type: "boolean",
component: "switch",
label: "Bar / Line",
ref: "qDef.measure.type",
options: [
{
value: true,
label: "Bar",
},
{
value: false,
label: "Line",
},
],
defaultValue: true,
},
measureaxis: {
type: "boolean",
component: "switch",
label: "Secondary Axis",
ref: "qDef.measure.axis",
options: [
{
value: false,
label: "Primary axis",
},
{
value: true,
label: "Secondary axis",
},
],
defaultValue: false,
show: function () {
if (!qDef.measure.type) {
return true;
}
},
},

},

Hopefully  you can see what I'm trying to do?  Please can you advise what I need to do to get this to work?

Thanks

Dom

Labels (3)
1 Solution

Accepted Solutions
ajaykakkar93
Specialist III
Specialist III

Hi @Domski74 ,

Here this is a solution for your issue

---------------------------------------------------------------
show: function (e) {
if (e.qDef.measure.type) {
return true;
}else{
return false
}
}

---------------------------------------------------------------

Please mark the correct replies as Solution. Regards, ARK
Profile| GitHub|YouTube|Extension|Mashup|Qlik API|Qlik NPrinting

View solution in original post

3 Replies
ErikWetterberg

The show function has parameters that containg the current values of the properties, so you need to check the content of those.

I don't think the parameters are well documented, so a first step would be to simple check the contents, like this:

show: function (data){

   console.log('show', data);

}

Hope this helps

ajaykakkar93
Specialist III
Specialist III

Hi @Domski74 ,

Here this is a solution for your issue

---------------------------------------------------------------
show: function (e) {
if (e.qDef.measure.type) {
return true;
}else{
return false
}
}

---------------------------------------------------------------

Please mark the correct replies as Solution. Regards, ARK
Profile| GitHub|YouTube|Extension|Mashup|Qlik API|Qlik NPrinting

Domski74
Contributor II
Contributor II
Author

Hi

Thanks Ajay, I'd actually already figured this based on Erik's answer, but your answer is absolutely correct, thank you.  I'll mark yours as correct.

Cheers

Dom