6 Replies Latest reply: Jun 30, 2011 9:31 AM by Navin Gorapalli RSS

    Problem with a set expression

      Hi,

           I need to populate a chart based on whose y values are Counts as the expression below suggests.

         

          count({1<System={$(vShowSystem)}>} Component).Here System and Components are fields

       

          vShowSystem is a variable which has a system based on the selection made in the system Listbox.It has only one value.

       

          I am able to get the value in the Variable but me chart is not showing me any data.

       

          But,instead of this if I give some defined value.Something like this,

           count({1<System={"ACOM"}>} Component) I am getting the correct values.

       

       

          Please let me know the mistake I am commiting

       

       

      Regards

      Navin Gorapalli

        • Problem with a set expression
          Kaushik Solanki

          Hi,

           

             Try this expression

           

             count({<System= {$(=GetFieldSelections(System))}>}Component)

           

             Hope this will help you.

           

             If not then please do  specify how you are getting value in variable.

           

             Specify the expression used for variable.

           

          Regards,

          Kaushik Solanki

            • Problem with a set expression

                Hi,

               

                    I  am getting the variable value from the selection made on system.

               

                    I have set the variable value to=GetFieldSelections(System).

               

                    I have tried thw way you suggested but with no result.

               

                    Please let me know the right way.

               

                Regards

                Navin Gorapalli

                • Problem with a set expression
                  Kaushik Solanki

                  Hi,

                   

                      The problem with GetFieldSelection is that, if you select All values it will show you ALL, instead of list of all values.

                   

                      Thus it is not working.

                   

                      So use below macro to set the variable, with selected field values.

                   

                     

                  Sub GetValues

                  set val=ActiveDocument.Fields("Year").GetPossibleValues

                  set Var = ActiveDocument.GetVariable("Variable")

                   

                   

                  for i=0 to val.Count-1

                       if abc = "" then

                            abc = val.Item(i).Text

                       else

                            abc =abc &","&val.Item(i).Text

                       End if          

                           

                  next

                  Var.setcontent abc, true

                  end sub

                   

                   

                  and use this expression in your chart.

                   

                   

                  count({<Year = {$(#Variable)}>}1)

                   

                   

                  Regards,

                  Kaushik Solanki