7 Replies Latest reply: Dec 2, 2011 12:13 PM by Jonathan Shaltz RSS

Bug on Rename Field

Panetta Luca Jonathan

Hi guys!

 

Today I have created a Sub to create a standard MasterCalendar. I have all fields and I want to remane only the field Date.

 

I have try to write

Rename FieldDate to SalesDate;

 

SalesDate is a field in Sales table.

 

The rename doesen't work.

 

I have the same problem in QV10 SR2 build 8935.7.

 

I have verified that the problem occurs when I try to rename a field that join with other field e.g. MasterCalendar with field Date that I try to rename in SalesDate and a table Sales with field SalesDate.

 

I think that is a BUG.

 

Regards

Luca Jonathan Panetta

PLJ Software

  • Re: Bug on Rename Field
    Miguel Angel Baeyens

    Hello Luca,

     

    Don't know if you missed in your post but the right syntax is

     

    RENAME FIELD OldName TO NewName;
    

     

    Are you getting some errors or crashes? Can you post some dummy data so we can check further?

     

    Regards,

     

    Miguel Angel Baeyens

    BI Consultant

    Comex Grupo Ibérica

    • Bug on Rename Field
      Panetta Luca Jonathan

      Hi Miguel,

       

      sorry, I misspelled, in the code I wrote correct

       

      RENAME FIELD FieldDate TO SalesDate;

       

      I tried to change the name of the field in  TestField and it work.

      RENAME FIELD FieldDate TO TestField;

       


      Regards

      Luca Jonathan Panetta

      PLJ Software

      • Re: Bug on Rename Field
        Miguel Angel Baeyens

        Hello Luca,

         

        Can you post some sample code or specify your scenario step by step so we can reproduce it?

         

        I'm trying to replicate it, renaming after joining, and it seems it's working.

         

        EDIT: I see what you say now. I haven't found anything in the Reference Manual, but it makes sense to me because the associative logic and the way QlikView has to associate one table to another. As it is always by means of the name of the field, I wouldn't be surprised I QlikView didn't allow to change any field to a name that is already associating two tables, after the model has been loaded. In the end, you can always change the name in the LOAD part if you want to create relations between tables.

         

        It doesn't allow you to do the opposite either. QlikView doesn't rename a relation field (key field) to any other name. My guess is that if you already wanted to do that, you could have done it in the LOAD process, renaming with "AS" to build/separate tables because of their fieldnames.

         

        And it doesn't work in version 9 either (SR6 Build 7646.9), which in turn adds sense to the above.

         

        Basically, QlikView allows renaming of fields to a new one that doesn't exist in your data model, but it doesn't to an already existing name. Or rather, it doesn't allow you to create links between tables using RENAME FIELD.

         

        Does any of this makes sense to you? Did you try in previous versions with different results?

         

        Miguel Angel Baeyens

        BI Consultant

        Comex Grupo Ibérica

         

        Message was edited by: Miguel Angel Baeyens

  • Bug on Rename Field
    Jonathan Shaltz

    I just bumped into this lovely little surprise, too.  It's bad enough that the system doesn't let you rename a key field, but what's inexcusable is that the system fails silently!  For *bleep*'s sake, the script should throw an error message saying "sorry, you can't rename key fields!"