Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
rajender_qlik
Creator
Creator

Macro for Disabling the conditional for expressions in chart

Hello,

I am looking for macro to disable only conditional expression in a chart but keeping the expression enable.

If anyone has the macro please keep posted here.

I have found macro in API guide for enabling the condition where as I am looking to disable the existed condition for expression

rem create new macro button

set newbutton = ActiveDocument.ActiveSheet.CreateButton

set prop = newbutton.GetProperties

prop.Type = 2    

prop.Text.v = "Run macro a"

prop.Macro = "a"

prop.EnableCondition.v = "count(Regions)<2"

newbutton.SetProperties prop

Thanks in Advance !!

Rajender

1 Solution

Accepted Solutions
rajender_qlik
Creator
Creator
Author

Thanks for the reply m w.

Yes I have tried but that didn't work. I have tried in another way and found the solution.

set expr = p1.Expressions.Item(1).Item(0).Data.ExpressionData

expr.Definition.v = "count(Regions)<2"

set expr = p1.Expressions.Item(1).Item(0).Data.EnableCondition

expr.Type =  1  '1-Disable, 2- Clear

expr.Expression = ""

This Macro code helps to enable the expression and disables the conditional when you run it.

View solution in original post

2 Replies
m_woolf
Master II
Master II

Have you tried:

prop.EnableCondition.v = ""

rajender_qlik
Creator
Creator
Author

Thanks for the reply m w.

Yes I have tried but that didn't work. I have tried in another way and found the solution.

set expr = p1.Expressions.Item(1).Item(0).Data.ExpressionData

expr.Definition.v = "count(Regions)<2"

set expr = p1.Expressions.Item(1).Item(0).Data.EnableCondition

expr.Type =  1  '1-Disable, 2- Clear

expr.Expression = ""

This Macro code helps to enable the expression and disables the conditional when you run it.