Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a chart with 4 different expressions. The client has asked to be able to have user select which expressions to based on checking a box next to each expression in the legend. Is this possible?
If this is a straight table, and you are using Version 9 then it would be very easy because each expression has a conditional show against it.
I'm guessing that this is not a straight table, perhaps bar chart/line chart/other chart.
I would create three copies of the chart, each one showing a different expression. Each chart would have a show condition set in the layouts properties according to the value of a variable. Your buttons could simply set the value of that variable to whatever is appropriate for that button (View1, View2, View3). Again, if you are using V9 then it is very easy to assign a value to a variable via a button, but if you are using an earlier version it's still relatively easy through macros.
Having read it again, I may have misread the requirement, do you want the user to be able to select any or all of those expressions (i.e. user can select to show 1,2,3 or all 4 of them)? If this is the case then it's more difficult, and although other peopple have done it I gave up with it because I had stability issues with the complex macro that is required to achieve it.
Yes, the user wants to display any combination of the expressions at one time. The wish was to be able to select/unselect the various expressions to display on the single chart. Thanks for your quick input.
It would definitely be a nice feature in a future edition: "User Selectable Display".
If I couldn't persuade them not to do this, and bearing in mind it's only 4 dimensions, then I would do it with multiple objects. This means creating a copy of the object for each combination of displayed expressions available (with 4 expressions, this means creating 14 copies of the object).
Each object would be displayed on a condition, so you only have one object displayed at any one time.
The problem with this approach is fairly obvious, the maintenance can be pretty tiresome if you have changes on the chart (because you have to make those changes to all 14 objects).
Anyway, let me know if you need any further help on it.
And then I already have the chart conditionally displayed 3 times already because I am required to use 3 different pre-aggregated fact tables. So now I would be creating the object 14 x 3 times for 42 instances. FORGET IT!!!
Again, thanks for the quick response. Great help!
Yeah, that's a real no-brainer.
Another option you might consider is to achieve it within the expressions themselves, this might prove a little challenging but it might be possible to have values in the right places with correct labels, but I suspect you would also have columns showing zeros with no labels where the user doesn't want to show something.
EG; User selects to show columns 1 & 4, so you'd like these in column 1 & 2.
Expression for column 1 would be something like ...... IF(VariableShow1 = 'YES' , Sum(Value1) , IF(VariableShow2='YES' , Sum(Value2) , IF............. etc
Similar for the label on column1.
Then for column2, you do the same thing but starting with number 2 and having a zero as the final else.
Not sure about this one myself, but it might be worth a quick try just to see if you like the concept.
Also, take a look at this thread.
http://community.qlik.com/forums/p/19257/73842.aspx#73842
Like I said before, I ended up dumping this method due to stability issues but that might have been the way I implemented it. The API is certainly designed to "allow" you to achieve this, up to you if you want to spend time on it.
Hi
I have used John's example to create variable dimensions and also macro code to show/hide expressions (v9).
I did not encounter any failures doing so
Juerg
Let's keep in mind that if it IS a straight table, the very first thing Nigel mentioned will work just fine, no need for macros or other complexity. See attached. I'd definitely do that in preference to the macro approach if it's just a straight table, and you're only manipulating the expressions, not the dimensions.