Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
hovhannisyan
Contributor
Contributor

Facing problem returning sheet object in container

Hi Guys,

I do not have so much experience in QlikView Object classes and currently I am facing the following problem.

I have a sheet object (Pivot Table) and its Object Id ("CH35") I am using in macro code (ActiveDocument.ActiveSheet.SheetObjects("CH35")) to return that Object and all its properties. Works perfect when the object is visible in the sheet's property under Object tab.  Nevertheless, if I have that object only in the container (no more linked Object) I am not able to return that object class. I looked through the Qlikview API guide and as well as read nearly all posts related to this topic:

"IArrayOfContainerItemDef" member (accessed by IContainerProperties.ContainedObjects)  suggests further "Item" attribute which is not returning that Object class/member itself.

I would very much appreciate any help and comments.

Thank you in advance

Sincerely,

Khoren

6 Replies
marcus_sommer

This worked for a chart (without linked objects) within a container:

set table = ActiveDocument.GetSheetObject( "CH21" )

msgbox table.GetColumnCount

- Marcus

hovhannisyan
Contributor
Contributor
Author

Thank you Macrus for your reply,

As I understand,  you can call/return Objects and use its properties unless it is visible in Sheet's properties. There you can see all objects and their corresponding IDs; hence they can be accessed with .GetSheetObject("ObjectId") method. In my case, the Object itself is not visible in sheet properties dialog (there is not linked object visible in the sheet), but only as an "Objects displayed in Container".

It is possible to return the text/caption and some other attributes by calling from .GetProperties method (for example,

.GetProperties.ContainedObjects.Item(i).Text.v), but this method does not return the object. I can return it as "Interface Data Object class" class and not "QlikView Object class".

See also the extract from API:

class.png

Class2.png

Nevertheless, thank you for your reply,

Sincerely,

Khoren

marcus_sommer

The solution will be to make these sheets and objects visible - for example you could use a hidden sheet with the linked objects (this is a quite useful approach for all things which are related to export or print anything) and within your routine you changed a variable-value which is the visibility-condition, accessed your object (what ever you want to do) and afterwards you changed the variable again and hides the sheet.

- Marcus

hovhannisyan
Contributor
Contributor
Author

Thanks for interesting idea. I will try that option as well. My Pivot Table is very big in volume, so I prefer not have any linked objects.

Anyway, thanks

Sincerely,

Khoren

Shisho_Karsenty
Contributor III
Contributor III

I have the exact same problem!!

I need all "Objects displayed in Container" ObjectID's within container "CT01".


Work for all objects in sheet:

Sub PrintAllObjectInSheet

Objecte = ActiveDocument.ActiveSheet.GetSheetObjects

For i=LBound(Objecte) To UBound(Objecte) 

      MsgBox(Objecte(i).GetObjectID)

Next

End sub

Has anyone found a workaround?
hovhannisyan‌?
marcus_sommer‌?

Sincerely,

Sam

marcus_sommer

The workaround is not to use objects in containers else linked or cloned objects in a hidden sheet or to simulate a container by using several textboxes which display a frame and object-headers which work as buttons changing a variable which controlled the visibility of the included charts.

If you want to try it with a container then these links will be helpful:

Re: How to identify which Object ID is active inside a container

Re: Get Active object in a Container

- Marcus