Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
jim_chan
Contributor III

Function only some objects in macro script

Untitled.png

Hi experts,

I would like to create a button that will restore ONLY the objects in the red box. Is anyone can help me.. the CH... are the object ID for each objects

With this macro script is restore all of the object include left hand side list box:

sub MaximizeAll

Objects = ActiveDocument.ActiveSheet.GetSheetObjects

For j = lBound(Objects) To uBound(Objects)

set obj = Objects(j)

obj.Restore

next

end sub

But i just want restore the object in the red box only. Is anyone can help me?

Thank you very much

1 Solution

Accepted Solutions

Re: Function only some objects in macro script

if it is less objects, you can try like this..

sub MaximizeAll ()
      ActiveDocument.GetSheetObject("CH01").Restore
      ActiveDocument.GetSheetObject("CH02").Restore

      ActiveDocument.GetSheetObject("CH03").Restore
end sub

View solution in original post

5 Replies

Re: Function only some objects in macro script

if it is less objects, you can try like this..

sub MaximizeAll ()
      ActiveDocument.GetSheetObject("CH01").Restore
      ActiveDocument.GetSheetObject("CH02").Restore

      ActiveDocument.GetSheetObject("CH03").Restore
end sub

View solution in original post

Re: Function only some objects in macro script

Hello Jim,


You can also use button actions to minimize and maximize the objects like below. Sample attached for your reference.

Capture.PNG

jim_chan
Contributor III

Re: Function only some objects in macro script

Thanks settu,

it works for me...thanks you very much

Re: Function only some objects in macro script

Another way is to list out the  Object ID which are needed to restore  in inline table of the script

Objects:

LOAD * inline [

ObjectID

CH01

CH02

CH03 ];


you can take this object ID field in listbox on front end and note the objectID of listbox


Now use the macro like below


sub MaximizeAll

set LB = ActiveDocument.GetSheetObject("LB01")

boxvalues=LB.GetPossibleValues

for i = lbound(boxvalues) to ubound(boxvalues)

set obj = Objects(i)

obj.Restore

next

end sub

Re: Function only some objects in macro script

Even you can try this too.. with less code..

sub MaximizeAll ()

SheetObj=Array("CH01","CH02","CH03")  ' Chart ID's here
for i=0 to UBound(SheetObj)
ActiveDocument.GetSheetObject(SheetObj(i)).Restore
Next

end sub