Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Highlighted
koushik_btech20
Contributor

Macro for Enabling or Disabling Expression dynamically

Hi Everyone,

I have a category or component table which I have to extract from DB so the data which will consist uder Category field will be dynamic . Now for each category I am creating expression and label.So there are already 2 expression present in the pivot chart which will be by default and now based on the Category or component field selection we have to enable or disable expression and have to show selected component label for the corresponding expression. I was trying that problem through macro. May be it is possible through macro . Could anyone check and let me help.Please check the attached application.

Regards,

Koushik

3 Replies
Siva_Sankar
Honored Contributor

Re: Macro for Enabling or Disabling Expression dynamically

Koushik,

Below is the code

sub ends

set myobj = ActiveDocument.GetSheetObject("CH01")

set v = ActiveDocument.GetVariable("VClikCount") '' first create a varible using setting

Cnt= v.getcontent.String

prop = myobj.GetProperties

if Cnt=0 then

  set expr = prop.Expressions.Item(0).Item(0).Data.ExpressionData

  expr.Enable = true                      'enable first expression

  set expr1 = prop.Expressions.Item(1).Item(0).Data.ExpressionData

  expr1.Enable = true    'enable second expression

  set expr1 = prop.Expressions.Item(2).Item(0).Data.ExpressionData

  expr1.Enable = false    'disable second expression

  v.setContent "1",true

else

  set expr = prop.Expressions.Item(0).Item(0).Data.ExpressionData

  expr.Enable = false                'disable first expression

  set expr1 = prop.Expressions.Item(1).Item(0).Data.ExpressionData

  expr1.Enable = true    'enable second expression

  set expr1 = prop.Expressions.Item(2).Item(0).Data.ExpressionData

  expr1.Enable = true  'enable second expression

  v.setContent "0",true

end if

myobj.SetProperties prop

end sub

MVP
MVP

Re: Macro for Enabling or Disabling Expression dynamically

Not sure if I understood right. You may try like shown here : Adhoc reporting in Qlikview

koushik_btech20
Contributor

Re: Macro for Enabling or Disabling Expression dynamically

But the selection data is not static so I cant do this in the way we do in Adhoc reporting.