7 Replies Latest reply: Nov 15, 2013 6:20 AM by David Thorpe RSS

    Basic Variable Creation

      Hi all,

       

      I've got an extremely basic question around creating a variable based on a field value.

       

      Field name = Store_Group

      Possible values = Group X, Group Y, Group Z

       

      How can I create a variable to only display Store_Group where the value = Group X?

       

      Basically I have a few charts that will be pre-filtered for report users.

       

      Many thanks,

       

      Dave

        • Re: Basic Variable Creation
          Kaushik Solanki

          Hi,

           

               Instead of variable, you can use the Set Analysis to filter the data in the charts.

           

               Anyways, in your scenario, you want variable name to be Group X or you want that variable to hold the value Group X?

           

          Regards,

          Kaushik Solanki

          • Re: Basic Variable Creation
            Stefan Wühl

            Not sure if you need a QV variable here, wouldn't the variable just hold 'Group X' then?

             

            If you want to filter a chart permanently, you can either create a calculated dimension

             

            =if(Store_Group = 'Group X', Store_Group)

             

            and Suppress NULL on dimension tab.

             

            Or use a set expression in all your expression aggregation functions, for example

             

            =sum({<Store_Group = {'Group X'}>} Value)

            • Re: Basic Variable Creation
              Sudeep Mahapatra

              If you just wanted your charts to show Store_Group='GroupX' then you can use set analysis in the chart expression.

              sum({<Store_Group={'Group X'}>}amount ) or

              if you want this to be a default value in the Store_Group filter box so that when user logs in they will see this by default and they can select another value of Store_Group from the filter box if they want. for this you can use Trigger Action (Select in Field) and you can have a Clear button created which will have the Select in Field action of Store_Group field as the Group X so that when users hit clear button the value goes back to default value.

              • Re: Basic Variable Creation
                Tresesco B

                If your variable is static(only one possible value), then you can directly store the string in the variable or use that string in place of the variable directly.If variable, then like:

                vVariable='Group X'

                • Re: Basic Variable Creation

                  Hi Dave,

                   

                   

                    Use the GetFieldselection() function. it gives you the selection of the field value.

                   

                    Declare a varaible

                   

                     Ex : $(V1)=Getfieldselection(Fieldname) and then give it a layout condition $(V1)=Group X then it displays whenever the varaible having GroupX.

                  • Re: Basic Variable Creation

                    Thanks all, lots of useful suggestions.