7 Replies Latest reply: Jun 18, 2010 12:54 PM by John Witherspoon RSS

    Can you rename values on a chart?

    davepage

      Once data is loaded into Qlikview and I am creating charts, is there a way to alter the name of values. Example, if my field is gender, and the available values are M, F, U. Can I change them to say Male, Female, Unknown?

      Thanks for your time.

        • Can you rename values on a chart?
          John Witherspoon

          pick(match(Gender,'M','F','U'),'Male','Female','Unknown')

          However, you're usually better off doing this in the script than in the chart. Create a field like "Gender Description" or something. Either join it onto your main table, or create a gender table to link genders to descriptions.

            • Can you rename values on a chart?
              davepage

              John,

              Can you explain 'pick match'? I'm a novice at Qlikview at this point and trying to weed my way through this. Where do I enter that script?

                • Can you rename values on a chart?
                  John Witherspoon

                   


                  davepage wrote:Can you explain 'pick match'? Where do I enter that script?


                  Match() returns a number indicating which value your field matched.
                  Pick() assigns the value corresponding to a number.

                  Put them together, and you're assigning values in one list based on another list.

                  As for where it goes in the script, I'd put it wherever you're loading the Gender field.

                  LOAD
                  ...
                  ,Gender
                  ,pick(match(Gender,'M','F','U'),'Male','Female','Unknown') as "Gender Description"
                  ...

              • Can you rename values on a chart?
                Aravinda Gajjarapu

                Another easy way is using Inline Wizard in the Edit Script.Which generates something like the below script and Field Gender can be used in the Charts.

                LOAD * INLINE [

                 

                gender,Gender

                M,Male

                F,Female

                U,Unknown

                ];

                Regards,

                Aravinda



                  • Can you rename values on a chart?
                    davepage

                    I've never used the Inline Wizard. I found it, replicated the script you provided as example.

                    Just not sure how to implement? Do I need to reload?

                    Also, am I creating a new version of the field (in this example Gender) or just using the variable name I want to cange value names for?

                    Thanks

                      • Can you rename values on a chart?
                        Aravinda Gajjarapu

                        I sometimes use Inline Wizard to match Months with Quarters,the first 3 months as Q1 and later 3 as Q2 and so on.When Inline Wizard chosen you can see a dialog like spread sheet.Clolumn will be a field loaded into Qlikview.Row is record.Choose the cell to enter value.

                        Double click on F1 and enter your field and do the same on F2 and give a field name.Now Now under column F1 enter row values M,F and U.now under F2 enter Male,Female and Unknown.Click ok and yes you have to reload the script.

                        Just give it a try but I would recomend solution given by John.

                         

                         

                         

                         

                          • Can you rename values on a chart?
                            John Witherspoon

                            I should probably mention that I only use pick(match()) for a small number of values. For a larger number of values, I would typically use a table like you described earlier, either left joining it onto my data set, or turning it into a mapping table and applying it as a map:

                            [Gender Map]:
                            LOAD * INLINE [
                            Gender, Description
                            M, Male
                            F, Female
                            ];
                            ...
                            LOAD
                            ...
                            ,Gender
                            ,applymap('Gender Map',"Gender",'Unknown') as "Gender Description"
                            ...