The Record Variable Must Belong to table 27 but not 50000.

Aymen_A_AmeenAymen_A_Ameen Member Posts: 2
Hi mibuso,

I am Aymen, a new memebr of mibuso, from Iraq. I am working as the IT manager of Ace Hardware stores and our ERP system is Microsoft Dynamics NAV 2009 R2 with LS Retail 6.3.

We are about to open our first store and today I got the following request from our warehouse supervisor:

He said can I get the item shelf label to be printed in order of the Product Group Code without any filter being applied?

I said well,,,,, yeah, we can do that but in this case I'll have to create a new table (50000) which is a copy of the item table (27) and then I'll change the primary Key for the new table (50000) to be the Product Group Code instead of No. (which is the item No.). And then I'll have to link the report to that table instead of the original item table (27). However I did all that, but when I tried to update the primary key for the newly created table (50000) I got the following error:

"The Record Variable Must Belong to 27 but not 50000"

after hitting ok for that message, the debugger takes me to the code editor and places the cursore as shown shown in Red below:


IF VariantSetup.READPERMISSION() THEN
IF "Variant Framework Code" = '' THEN
BEGIN
VariantsReg.SETRANGE(VariantsReg."Item No.","No.");
IF NOT VariantsReg.FIND('-') THEN
BEGIN
IF "Variant Framework Code" = '' THEN
"Variant Framework Code" := RegVariants.ReturnFrameworkCode(|Rec,FALSE);

IF VariantSetup.GET("Variant Framework Code") THEN
IF (VariantSetup."Registration Type" = VariantSetup."Registration Type"::Automatic) OR
(VariantSetup."Registration Type" = VariantSetup."Registration Type"::"Automatic Selection")
THEN
RegVariants.RUN(Rec);
END;
END;


Can anybody guide me to how to fix this problem?

Thanks in advance,
and glad to be a member of this family.

Comments

  • krikikriki Member, Moderator Posts: 9,112
    [Topic moved from 'NAV Tips & Tricks' forum to 'NAV/Navision Classic Client' forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    My first guess is you need some senior help with this project, but for this specific scenario; if you copy a table to a new number you might want to delete all the code that is in the table and have a look at some flowfields and tablerelations before renaming records.
  • vaprogvaprog Member Posts: 1,141
    Why don't you just add a key for "Product Group Code" to the Item table?

    If you don't want to do this modification to the Item table, you can add a Dataitem for the "Product Group" table before the Item Dataitem and link the two in the report. This may not be very fast to run, but you won't need it all the time.

    With your approach you will get problems because usually you will have more than one Item per Product Group, so you needed to add the Item No. as a secondary field to the primary key, but thus you are better off just adding a secondary key.
Sign In or Register to comment.