1 Reply Latest reply: Jul 8, 2011 7:00 PM by Stefan Wühl RSS

    Hide a dimension column in a pivot chart or straight table

      ''Hide a dimension in pivot chart or straight table


      ''Define the following variable vShowCustomers via the script.

      ''SET vShowCustomers = 'Hide';


      ''Create Input Field to toggle vShowCustomers variable values between 'Hide' and 'Show'.


      ''Create the following macro. 

      ''I found this macro on QV community at http://community.qlik.com/message/37992#37992.


      ''Dimension index starts at '0'...

      sub mToggleCustomers

      set var = ActiveDocument.Variables("vShowCustomers")

      varValue = var.GetContent.String

      set obj = ActiveDocument.GetSheetObject("CH26")

      set objProp = obj.GetProperties

      set objDim = objProp.Dimensions

      if varValue = "Hide" then

      objDim(1).ColWidth = 0

      var.SetContent 0,true


      objDim(1).ColWidth = 1000

      var.SetContent 1, true

      end if

      obj.SetProperties objProp

      end sub


      ''Create an OnChange Variable Event Trigger within document properties for varable vShowCustomers.

      ''This event will run macro 'mToggleCustomers


      ''Within the Chart Properties, define the dimension with the variable condition.

      ''Make sure the else is a ' ', not a ''...

      ''=if(vShowCustomers = 'Show', Ship_to_Customer_Name, ' ')


      ''Within the Chart Properties-->Presentation tab, set a conditional show on the dimension

      ''vShowCustomers = 'Show'


      ''Within the Chart Properties-->Presentation tab, set chart to "Always Fully Expanded"