2 Replies Latest reply: Mar 5, 2012 5:55 AM by Ashok Chandran RSS

    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