Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
sebastiandperei
Specialist
Specialist

Get Active object in a Container

Hi all...

I need to know the ID and/or the Caption of the active object in a container. I have tryed this API Guide 11 code:

Set ContainerObj = ActiveDocument.GetSheetObject("CT01")

set ContProp=ContainerObj.GetProperties

ActiveObject=ContProp.SingleObjectActiveIndex

msgbox("Active Object=" & ActiveObject)

Msgbox("  Id=" & ContProp.ContainedObjects.Item(ActiveObject).Id)

I can see the order of the active object (0,1,...), but "ContainedObjects.Item(ActiveObject).Id" is not working. Im using QV11.20 SR9.

I have seen some similar not answered posts with this question. It's a bug?

Thanks!

1 Solution

Accepted Solutions
marcus_sommer

If you used names for your objects inside from the container then you get with the following code these label:

set CTObj = ActiveDocument.GetSheetObject("CT02")
set CTProp = CTObj.GetProperties  
msgbox CTProp.ContainedObjects.Item(CTProp.SingleObjectActiveIndex).Text.v

If these name contained the object-id like "Bar-Chart Sales - CH01" you could read this per string-functions and used it for further purposes (not really nice but a workaround).

- Marcus

View solution in original post

2 Replies
marcus_sommer

If you used names for your objects inside from the container then you get with the following code these label:

set CTObj = ActiveDocument.GetSheetObject("CT02")
set CTProp = CTObj.GetProperties  
msgbox CTProp.ContainedObjects.Item(CTProp.SingleObjectActiveIndex).Text.v

If these name contained the object-id like "Bar-Chart Sales - CH01" you could read this per string-functions and used it for further purposes (not really nice but a workaround).

- Marcus

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