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: 
Not applicable

Get container index and show/hide text object based on it

I have a container with three line charts. Also I have a text object.

I am trying to hide/show text object when container index is 2 or 3, assuming that container index starts from 1. When container index is

1, text object always remains hidden.


So from text object properties, in design tab, I want to set a condition to show/hide object based on container index but I do not know how to get container index.


I know it is possible to get container index using a macro, like explained here:

Container Object,Selected Index Change


but I do not want to use macros. I want to use a variable (ShowTextObject), that is, if container index is 2 or 3, the this variable is set to 1, otherwise (if container index is 1), this variable gets 0. So I show text object based on the following condition:


=ShowTextObject=1

So when container index changes, how to set variable ShowTextObject to 0 or 1 accordingly?

6 Replies
Gysbert_Wassenaar

but I do not know how to get container index.

You can't without using a macro. Try doing without the container and show/hide the objects (those you now have in a container) using variables and actions as  well as the text box. You could even create an inline table with one field that you can use in a listbox as a kind of menu.


talk is cheap, supply exceeds demand
Not applicable
Author

Is it possible to set the variable on line chart selection? I cannot see any place to set an action on chart selection. I am using QlikView 11. So if it was possible I would set the variable to 0 or 1 depending on the chart selected.

Gysbert_Wassenaar

No, objects do not have an OnActivate event trigger. What you can do instead is use another kind of trigger to show/hide both the chart and the text box. That can be a field trigger or a variable trigger. Or an action assigned to a button or text box.


talk is cheap, supply exceeds demand
Not applicable
Author

Yes, but I need to hide/show only the text object if two of three charts are selected...

Gysbert_Wassenaar

Then enable the text box not just for one chart, but for the two or three charts.


talk is cheap, supply exceeds demand
Or
MVP
MVP

Tony,

Consider replacing the container entirely:

Instead of the container's chart selections, have three text objects, one for each object. When clicked, each will trigger a variable to a different value (e.g. 1, 2, 3).

For each chart, display it only if the variable is 1, 2, or 3 as appropriate.

This approach is a little more clunky to manage, but it is significantly more robust insofar as both layout options and the ability to change other settings when a specific object is selected.