Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Coming Aug. 9: New Simplified Authoring for Qlik Sense SaaS – For Details, CLICK HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
cbaqir
Specialist II
Specialist II

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
pamaxeed
Partner - Creator III
Partner - Creator III

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
pamaxeed
Partner - Creator III
Partner - Creator III

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

cbaqir
Specialist II
Specialist II
Author

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

I don't suppose there are any other options?

StevenJDH
Employee
Employee

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