11 Replies Latest reply: Jun 26, 2018 7:23 AM by Andreas Braun RSS

    How to rename a field in qlikview

      plz help me out with different ways to rename a field or to rename a column name of Inline table with a sample code.

       

      regards,

      Mandar

        • Re: How to rename a field in qlikview
          venkata Sreekanth

          use alias

          like

          [FieldName] as [NewFieldName]

          • Re: How to rename a field in qlikview
            vishal waghole

            Hi mandar,

             

            Try this

             

            Temp:

            Load * Inline [

            Month, Sales

            Jun, 123

            Jul, 234

            Aug, 432

            ];

             

            Load      Month as MonthName,

                         Sales as SalesAmount

            Resident Temp;

             

            -- Regards,

            Vishal Waghole

            • Re: How to rename a field in qlikview
              Anand Chouhan

              In inline table you can rename a field with different approach

               

              Ex:-

              Load Field1 as Customers ,Field2 as Sales; //By this line as preceding load you can rename

              Load * Inline

              [

              Field1,Field2

              A,100

              B,200

              C,300

              D,400

              ];

               

              Ex:- Or by any resident load you can rename the field

              Tab1:

              Load * Inline

              [

              Field1,Field2

              A,100

              B,200

              C,300

              D,400

              ];

               

              NewTable:

              Load

              Field1 as Customers ,

              Field2 as Sales

              Resident Tab1;

               

              Drop Table Tab1;

              • Re: How to rename a field in qlikview
                venkata Sreekanth

                Hi Mandar,

                Try this code

                 

                 

                Load MonthID as DateID,Month inline [
                MonthID,Month
                1,Jan
                2,Feb
                ]
                ;

                 

                • Re: How to rename a field in qlikview
                  Eduardo Sommer

                  You can use

                   

                  Rename OldFieldName to NewFieldName;

                   

                  Eduardo

                    • Re: Re: How to rename a field in qlikview
                      Miguel Angel Baeyens de Arce

                      Syntax would be

                       

                      RENAME FIELD OldFieldName TO NewFieldName;
                      
                      RENAME FIELDS OldName1 TO NewName1, OldName2 TO NewName2, OldName3 TO NewName3;
                      
                      

                       

                      And my favorite:

                       

                      FieldNamesMap:
                      MAPPING LOAD OldName,
                      NewName
                      FROM File.qvd (qvd);
                      
                      RENAME FIELDS USING FieldNamesMap;
                      
                      

                       

                      Miguel

                        • Re: How to rename a field in qlikview
                          JULIAN RODRIGUEZ

                          Hola Miguel

                           

                          Las dos opciones sugeridas me funcionan bien, tanto para renombrar campos como para mantener el vínculo entre los objetos de presentación con los campos renombrados.

                          Esto, claro está, si lo hago en un documento de prueba.

                           

                          Pero, sucede que tengo un documento con 600+ campos, y al renombrarlos con cualquiera de las opciones descritas, los objetos quedan desvinculados al campo nuevo y debo volver a asignarlos, bien sea uno por uno, o por el diálogo "Vista prievia de la Expresión (Ctrl+Alt+E)".

                           

                          Existe un límite en el número de campos que se puedden renombrar sin que se pierda el enlace entre el objeto/expresión/variable que lo contiene, para que Qlikview lo reemplace de manera automática?

                           

                          Debo entonces cambiar todo manualmente?

                           

                          Gracias por tus comentarios

                            • Re: How to rename a field in qlikview
                              Andreas Braun

                              Hi all,

                               

                              I am wondering the exact same thing as Julian! Is there any easy option to refactor variable names in Qlik?

                              Here's the translation of Julians post. I hope someone can help! Thanks!

                               

                              ------

                               

                              The two suggested options work well for me, both to rename fields and to maintain the link between the presentation objects and the renamed fields.
                              This, of course, if I do it in a test document.

                              But, it happens that I have a document with 600+ fields, and when renaming them with any of the options described, the objects are unlinked to the new field and I must reassign them, either one by one, or through the dialog "View of the first Expression (Ctrl + Alt + E) ".

                              Is there a limit on the number of fields that can be renamed without losing the link between the object / expression / variable that contains it, so that Qlikview can replace it automatically?

                              Should I then change everything manually?

                            • Re: Re: How to rename a field in qlikview
                              Nathaniel Anderson

                              Note

                              1. You can use dollar-sign replacement
                              2. You can / must use square-brackets if your names include spaces:

                              this example illustrates both effects:

                              SET vFieldOne = Field One;

                              RENAME FIELD FIELD_1 TO [$(vFieldOne)];

                          • Re: How to rename a field in qlikview
                            Michael Maeuser

                            you can also have a list in e.g. an excel looking like that

                            original name, new name

                            ...,...

                            ...

                             

                            and at the end of the script you can do like that

                             

                            rename fields using excelfile.xlsx;

                            • Re: How to rename a field in qlikview
                              Chip Matejowsky

                              Hey Mandar,

                              Be sure to use the Qlik Sense Help. Below is the entry for Rename Field.

                               

                              Rename field

                              This script function renames one or more existing Qlik Sense field(s) after they have been loaded.

                              Either syntax: rename field or rename fields can be used.

                              Syntax:

                              Rename Field (using mapname | oldname to newname{ , oldname to newname })

                              Rename Fields (using mapname | oldname to newname{ , oldname to newname })

                              Arguments:

                              ArgumentDescription
                              mapnameThe name of a previously loaded mapping table containing one or more pairs of old and new field names.
                              oldnameThe old field name.
                              newnameThe new field name.

                              Limitations:

                              Two differently named fields cannot be renamed to having the same name. The script will run without errors, but the second field will not be renamed.

                              Example 1:

                              Rename Field XAZ0007 to Sales;

                              Example 2:

                              FieldMap:

                              Mapping SQL Select oldnames, newnames from datadictionary;

                              Rename Fields using FieldMap;