Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

sebastiandperei
Valued Contributor

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
MVP & Luminary
MVP & Luminary

Re: Get Active object in a Container

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
MVP & Luminary
MVP & Luminary

Re: Get Active object in a Container

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

Highlighted
Support
Support

Re: Get Active object in a Container

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