6 Replies Latest reply: Mar 26, 2013 8:59 PM by kumar_siddasetty RSS

    Dynamic Chart (VB Script)

    Deepak Vadithala

      Dear All,

       

      I have a requirement to generate 4 dynamic charts based on the user selection. So I had decided to use $Field to display all dimension fields and then I wanted the user to select dimensions. Then my charts should populate based on the dimension.

       

      I had started to write some VB Script but I need more help on this...

       

       

      Sub Dynamic_Chart_Dimension_01

      Set MyChart = ActiveDocument.GetSheetObject("CH67")

      MyChart.SetReference

       

      MyChart.AddDimension "Gender"   -- This line of code now adds dimension

      MyChart.AddExpression "COUNT(Resp_ID)"  -- This line adds expression

       

      End Sub

       

      ~Here is what I need...

       

      1. I wanted to check if there is already dimension then the VB Script should replace the Dimension. However, if there is no Dimension then we need to add one. So it should simple IF, ELSE & End IF construct.

       

      2. Instead of using "Gender" as dimension I wanted an expression... something like the first selection from the list box. And for the next Chart the script should take the second selection from the list box.

       

      Many thanks in anticipation!

       

      Cheers - DV