Rename Item

forestforest Member Posts: 8
I got error on Renaming Item --

The field below much be included in the table's primary key
Field: Item Tracking Code
Table: Item

We are running NAV 4.00 SP3 version.
Has anyone seen this error? Thanks

RC

Comments

  • SavatageSavatage Member Posts: 7,142
    you have to do as it says to bypass this error

    goto designer & the design the item table.

    view->keys

    add the missing key.
  • forestforest Member Posts: 8
    I tried it. It did not work. The error was still.
  • kinekine Member Posts: 12,562
    Somewhere you in your DB someone used table relation Item."Item Tracking Code" which is not possible. You can do table relation just to Primary Key fields. It is why it wants now to add the "Item Tracking code" into primary key.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • AsallaiAsallai Member Posts: 141
    The keys are Valid in the Item table?
  • DenSterDenSter Member Posts: 8,305
    If I understand correctly, you want to modify the Item Tracking code, and you are trying to do this with the RENAME command. You would only use the RENAME command when you want to modify the primary key value of the record. For any other type of modification of existing records, you simply set the field, and then you use the MODIFY command, like this:
    MyItem.GET('SOMECODE);
    MyItem.VALIDATE("Item Tracking Code",'NEW VALUE');
    MyItem.MODIFY(TRUE);
    
  • forestforest Member Posts: 8
    I want to rename ITEM, not the Item Tracking Code.
    I use the core NAV function on the Item Card, or Item table and change the Item.No, which is the primary key of Item table. The NAV will start rename process. It started a while, then I got the error. Since we have implemented 3rd party solution, I wonder if any one can verify for me for the rename function in standard NAV 4.00 SP3 US version. Thanks a lot.
  • DenSterDenSter Member Posts: 8,305
    I understand you want to rename Item, it's just that you should not be using RENAME when modifying the Item Tracking field.
  • AsallaiAsallai Member Posts: 141
    The RENAME function is ONLY for the primary keys renaming! Not any!
    Use this function to change a primary key in a C/SIDE table.
    So, you cannot use this command for rename a non-primary key field.

    In normal case (not only in NAV) you cannot modify a primary key after insert procedure.
    That time, when the Navision does not contains the RENAME function, we use a simple method for the renaming:
    rItem.GET(ValueOfPrimaryKey);
    rItemTemp := rItem; //or TRANSFERFIELDS
    rItemTemp.ValueOfPrimaryKey := 'AnotherValue';
    if rItemTemp.INSERT(TRUE) then
     rItem.DELETE
    else ....
    
    
    

    And I think your error message was this:
    The field below must be included in the table's primary key
    Field: Item Tracking Code
    Table: Item
  • Alex_ChowAlex_Chow Member Posts: 5,063
    I also ran into this problem. Kine is absolutely dead right on the problem.

    The way I fixed the problem was to export the modified table objects as text and searched through the field in question. After I found the problem, I removed the table relation and it renamed beautifully.
  • themavethemave Member Posts: 1,058
    if you just want to fix this one issue, so you can get the item renamed, then do a negative adjustment to bring the stock to zero. you will no longer have a tracking code assigned to it.

    rename it.

    then do a positive adjustment to bring it back and assign the tracking code back to the item.
  • David_SingletonDavid_Singleton Member Posts: 5,479
    I have posted about this bug many times before on The Dynamics User Group and at least a couple of times here Very topic - Very strange RENAME behaviour

    The bug was introduced in Financials ver 1.1. (0.9 and 1.0 did not have the bug). In the DOS version of Navision, reports imports and batch jobs had the name of the object as the primary key, but in Financials this was changed to an object number. So when you upgraded to financials they had to have a mechanism to allow a link to secondary keys. In reality this should have been just to do the upgrade, and then gone, but for some reason this "feature" remains till today.

    PS I first reported this bug in 1996, so good luck in getting anyone now 12 years later to listen. Back then they could not fix it, since it would then be difficult to upgrade from DOS, but seriously it has no sense now.
    David Singleton
  • kapamaroukapamarou Member Posts: 1,152
    I came across this error message and had to temporarily delete a table relation, make the change, and recreate the relation. This happened in 3.70. I tried the same thing with the same tables in 4SP3 and it works fine. Does anybody know if this has been corrected after some specific version?
  • Alex_ChowAlex_Chow Member Posts: 5,063
    kapamarou wrote:
    I came across this error message and had to temporarily delete a table relation, make the change, and recreate the relation. This happened in 3.70. I tried the same thing with the same tables in 4SP3 and it works fine. Does anybody know if this has been corrected after some specific version?

    No.

    The reason why it's not corrected is because it may not be a bug. Navision probably wants to punish you for violating relational database design theories.

    "you should not look up to a look up" :evil:
Sign In or Register to comment.