Error renaming record under SQL

Martin_Z.Martin_Z. Member Posts: 3
When I try to rename an Item record in a SQL database I get the error: "The field Productgroupcode has to be added to the primary key in table Item". It looks like it stops at the Bin Content Type table. It happens when I try it on the Item card and in the Item table. In the rename trigger I have only the standard navision code.

I can't debug this error and code coverage does not seem to give any information. When I perform this action in the same company in a C-Side database I don't seem to have that problem.

Is there anybody who can give me a clue what could be wrong? Thanx in advance! :D

Comments

  • DenSterDenSter Member Posts: 8,307
    You use RENAME only when you change values in primary key fields. Product Group is not part of the primary key of the Item table, at least not in standard Navision. Try using MODIFY instead.
  • matteo_montanarimatteo_montanari Member Posts: 189
    Martin Z. wrote:
    When I try to rename an Item record in a SQL database I get the error: "The field Productgroupcode has to be added to the primary key in table Item". It looks like it stops at the Bin Content Type table. It happens when I try it on the Item card and in the Item table. In the rename trigger I have only the standard navision code.

    I can't debug this error and code coverage does not seem to give any information. When I perform this action in the same company in a C-Side database I don't seem to have that problem.

    Is there anybody who can give me a clue what could be wrong? Thanx in advance! :D

    You have a field in a table relationed to item."Product Group Code". Change this relation to something like ""Product Group".Code WHERE (Item Category Code=FIELD(Item Category Code))"

    bye

    Matteo
    Reno Sistemi Navision Developer
  • Martin_Z.Martin_Z. Member Posts: 3
    Yep, you are correct Matteo. I found it out allready but thanks for your reply! :D

    I exported all tables to text and search for all tablerelations with Item and found it. There was a relation from a tablefield to item."product group code". I changed it to just Item and everything worked just fine.

    Can you explain to me why this was not a problem in C-Side?
  • Aida_GomesAida_Gomes Member Posts: 1
    Hi,

    I have a same problem, but with a decimal type field. It's a new field in table Insurance in SQL database. A error is "A field below must be included in the table's primary key. "

    What can I do??
    :-k

    Thanks
Sign In or Register to comment.