Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

justinasp
Contributor

Set expression "Conditional" show in macros

Hello all,

does anyone know if it is possible to set an option "Conditional" (+some condition) for the Expression in Chart Properties by Macros?

example.jpg

Thanks in advance!

Sincerely,

Justinas

Tags (2)
1 Solution

Accepted Solutions
justinasp
Contributor

Re: Set expression "Conditional" show in macros

Made it!

Sub ExpressionEnableCondition

    Set chart = ActiveDocument.GetSheetObject("CH01")

    Set cp = chart.GetProperties

    Set expr = cp.Expressions

    Set expr_data = expr.Item(0).Item(0).Data.EnableCondition

    expr_data.Type = 2

    expr_data.Expression = "here_goes_your_expression"

    chart.SetProperties cp

End Sub

3 Replies
fosuzuki
Valued Contributor II

Re: Set expression "Conditional" show in macros

Hi, found this in API Guide:

CLASS = ICondExDef

MEMBER = Expression

EXAMPLE:

set chart=ActiveDocument.GetSheetObject("CH01")

set cp=chart.GetProperties

set dims=cp.Dimensions

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

dims(0).Show.Type=1 '0=false, 1=true, 2=cond

expr.Show.Type=2

expr.Show.Expression="sum(a)<10000"

chart.SetProperties cp

Hope this helps

Fernando

justinasp
Contributor

Re: Set expression "Conditional" show in macros

This won't work for me. Your example controls Columns Presentation option:

wrong_example.jpg

What I need is a different thing.

justinasp
Contributor

Re: Set expression "Conditional" show in macros

Made it!

Sub ExpressionEnableCondition

    Set chart = ActiveDocument.GetSheetObject("CH01")

    Set cp = chart.GetProperties

    Set expr = cp.Expressions

    Set expr_data = expr.Item(0).Item(0).Data.EnableCondition

    expr_data.Type = 2

    expr_data.Expression = "here_goes_your_expression"

    chart.SetProperties cp

End Sub

Community Browser