Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Button for changing expressions in various charts in one go-help required.

Hi All,

I've four charts on my dashboard which have same three expressions used  on them .

These charts have different dimensions  .

I want to build a button clicking upon which all the four charts will switch its view to lets say, expression A  .

Another click to expression B  & so on .

I understand we can have a cyclic button for these expression swaps .But users don't want to go to different charts and change the expression .

Instead they want to change all the charts to same expression in one go .

Appreciate your advice .

Thanks .

1 Solution

Accepted Solutions
m_woolf
Master II
Master II

I had another thought that wouldn't require showing and hiding multiple charts.

In each chart enter the expression something like this:

=if(vExpr='Cond A'),ExpressionA,

     if vExpr='Cond B', ExpressionB,

          ExpressionC))

Then the button and variable should be enough to do what you want.

View solution in original post

8 Replies
m_woolf
Master II
Master II

Changing the chart expressions will require a macro.

An alternative would be to create three sets of charts, each set with a different expression.

Use the button (or Listbox or Multibox) to set a variable that will show the matching set of charts using conditional show.

Not applicable
Author

Thanks for your quick response.

I'm relatively new to qlikview .It'll be great if you could suggest further info  on the macro if possible ,like a sample may be .

I don't think the second option is possible .

As I always want all the four charts to be visible .

Button should change all  the chart views to same expression  when clicked on it .And show next expression for next click .Hope my question is clear .

m_woolf
Master II
Master II

One set of 4 charts would have their conditional show set to vExpr = 'Cond A',

one set would have their conditional show set to vExpr = 'Cond B', and

one set would have their conditional show set to vExpr = 'Cond C'

Here is code from the API Guide for setting a chart's expression via code:

rem change expression in chart

set chart = ActiveDocument.GetSheetObject("CH01")

set p = chart.GetProperties

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

expr.Definition.v = "sum(Amount)"

chart.SetProperties p

I still recommend the first solution.

Not applicable
Author

I'll work out the second option like you've suggested.

I don't have much experience with Macros.

Would you've any sample qvw's on using similar macro ?

Really appreciate all your sugggestions .

m_woolf
Master II
Master II

i have attached a sample qvw. There are no macros involved.

Tammy_Milsom
Community Manager
Community Manager

If you have QV11, you can use the new conditional enabling of dimensions/expressions, demo of this on the reports tab in the free 'What's new in qlikview 11' app on qlik.com

m_woolf
Master II
Master II

I had another thought that wouldn't require showing and hiding multiple charts.

In each chart enter the expression something like this:

=if(vExpr='Cond A'),ExpressionA,

     if vExpr='Cond B', ExpressionB,

          ExpressionC))

Then the button and variable should be enough to do what you want.

Not applicable
Author

Hey mwoolf ,

I tried your latest suggestion and it worked like a charm .

Many thanks for your help .Much appreciated