Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Now Live: Qlik Sense SaaS Simplified Authoring – Analytics Creation for Everyone: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Select Tab in the Container using Macro

Hi, All!

I have a Container with two tabs (two different tables inside). How could I using macro select one tab or another (accordingly user will see one table or another)?

Thanks.

12 Replies
Not applicable
Author

up

maneshkhottcpl
Partner - Creator III
Partner - Creator III

Hi,

As per my understanding u need to display the tables(Charts) as per buttons click or sheet activate using some buttons.

I m sending the solution for the both please refer the attached qve application. and revert me back for any clarifications.

Thanks

Manesh

Not applicable
Author

Hi, Manesh

Thanks. But I want that these tables are placed in the Container (please, see attach). If we click of first button - first tab will be displayed, second button - second tab will be displayed. Could you advice?

Thanks.

maneshkhottcpl
Partner - Creator III
Partner - Creator III

Hi,

Please refer the attached application.

Sheet1 --Press -- Display Sheet1

Sheet2--Press - Display sheet2

Revert for issue.

Not applicable
Author

Manesh, I should use Container. Where is Container in your example?

Not applicable
Author

Hi Maxim,

I haven't tried this yet, but API 11 has this example

Set ContainerObj = ActiveDocument.GetSheetObject("CT01")

set ContProp=ContainerObj.GetProperties

ActiveObject=ContProp.SingleObjectActiveIndex

msgbox("Active Object=" & ActiveObject & "  Id=" & ContProp.ContainedObjects.Item(ActiveObject).Id)

and property SingleObjectActiveIndex is described as read-write.

So you may try to assign to this property Id of one or another container object.

Not applicable
Author

Did anyone get this working please?

I need to activate an object within a container via a button.

murozel76
Contributor III
Contributor III

I have just tried a solution for the very same purpose and it has worked properly. Please find the sample code below. You can write as many copies of the same subprocedure as you need, by changing the name of the sub and the value of the MV_ActiveIndex variable so that you can attach each sub to a button, enabling your macros to be run when clicked on the relevant buttons.

Hope this helps.

Regards,

sub ContTabSelect0

set MV_ContainerObj = ActiveDocument.GetSheetObject("CT13")
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

ajbunger
Contributor
Contributor

Did you ever get this to work on a button?