Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

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

Activate Chart within Container from Button?

I have a tab with 3 containers on it. Each container contains two charts. I also have a couple of buttons. My requirement is that selecting a button (or re-opening the tab) causes a specific chart within each container to activate. I've tried using the Button Action: Activate Object for both the container object and the chart object but it is not working. I do also have an Apply Bookmark Action in my Button Properties Actions if that makes a difference.

Any suggestions?

Your help is greatly appreciated.

Thanks,

Cassandra

1 Solution

Accepted Solutions
Partner
Partner

Re: Activate Chart within Container from Button?

HI,

you have to use a macro for that purpose and then you can use buttons and actions to trigger the macro event:

Here the code snippet:

sub ResetContainerObject

    ContTabSelect0("CT09")

    ContTabSelect0("CT07")

    ContTabSelect0("CT05")  

end sub

sub ContTabSelect0(ObjectID)

    set MV_ContainerObj = ActiveDocument.GetSheetObject(ObjectID)

    Set MV_ContProp = MV_ContainerObj.GetProperties

    MV_ActiveIndex2 = MV_ContProp.SingleObjectActiveIndex

    MV_ActiveIndex2 = 0

    MV_ContProp.SingleObjectActiveIndex = MV_ActiveIndex2

    MV_ContainerObj.SetProperties MV_ContProp

End Sub

View solution in original post

3 Replies
Partner
Partner

Re: Activate Chart within Container from Button?

HI,

you have to use a macro for that purpose and then you can use buttons and actions to trigger the macro event:

Here the code snippet:

sub ResetContainerObject

    ContTabSelect0("CT09")

    ContTabSelect0("CT07")

    ContTabSelect0("CT05")  

end sub

sub ContTabSelect0(ObjectID)

    set MV_ContainerObj = ActiveDocument.GetSheetObject(ObjectID)

    Set MV_ContProp = MV_ContainerObj.GetProperties

    MV_ActiveIndex2 = MV_ContProp.SingleObjectActiveIndex

    MV_ActiveIndex2 = 0

    MV_ContProp.SingleObjectActiveIndex = MV_ActiveIndex2

    MV_ContainerObj.SetProperties MV_ContProp

End Sub

View solution in original post

cbaqir
Valued Contributor

Re: Activate Chart within Container from Button?

It looks like using Macros is usually not recommended according to Macro.

I don't suppose there are any other options?

Support
Support

Re: Activate Chart within Container from Button?

This was an issue that I brought up to R&D a while ago. Those who are using certain versions QlikView will notice that these properties no longer produce the desired result. The API for getting the active object and changing the active object programmatically can be found in this article with examples: https://support.qlik.com/articles/000070090