Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Add Group (cyclic group) dimension to straight table using Macro

I have 5 different cyclic groups created in my document, and a straight table that I'm trying to allow the user to specify which group(s) to show/hide via some buttons on the form and a macro.  Adding one or more of the groups as dimensions to the table works fine via the UI as you'd expect, however I'm trying to write a VBScript macro that will add/remove these group dimensions based on a user clicking/reclicking buttons on the form. These buttons simply set a different variable for each group (on/off), and based on the variable values a macro should be adding/removing the dimensions from the table appropriately.  I can't seem to get the groups to add as dimensions programatically - here's what I've got for code so far (oversimplified, but should be functional):

dim v

dim t

set v = ActiveDocument.GetVariable("showGroupDim1")

set t = ActiveDocument.GetSheetObject("userTable")

if v.GetContent.String = "1" then

     t.AddGroupDimension("Group1")

end if

AddDimension doens't work, and AddGroupDimension always seems to return a returnval of -1 which I assume indicates some sort of failure, however there is no exception data or error details in the log, in the err object, or anywhere else.


Anybody know how this should be written?

Note that I've also tried wrapping this all in a dummy GetProperties / SetProperties on the table too..

Thanks in advance

2 Replies
Not applicable
Author

Hi,

I have the same problem.

Did you solve this problem?

Thanks

Anonymous
Not applicable
Author

Hi

     Hope the attached macro file will be useful to solve your problem

Regards

Ashok