Item::No. Item::Description Item::Base Unit of Measure Item::Inventory Posting Group Item::Item Category Code Item::Product Group Code Item::Costing Method Item::Unit Price Item::Unit Cost Item::Replenishment SystemWhen we import Item, the Item Unit of Measure table also need to be populated (automatically) through "onValidate" of "Base Unit Of Measure" field. But, I am getting an error saying
Microsoft Dynamics NAV
The field Item No. of table Item Unit of Measure contains a value (100010001) that cannot be found in the related table (Item).
OK
--Base Unit of Measure - OnValidate() IF "Base Unit of Measure" <> xRec."Base Unit of Measure" THEN TestNoOpenEntriesExist(FIELDCAPTION("Base Unit of Measure")); "Sales Unit of Measure" := "Base Unit of Measure"; "Purch. Unit of Measure" := "Base Unit of Measure"; IF "Base Unit of Measure" <> '' THEN BEGIN UnitOfMeasure.GET("Base Unit of Measure"); ItemUnitOfMeasure.SETRANGE("Item No.","No."); IF ItemUnitOfMeasure.ISEMPTY THEN BEGIN ItemUnitOfMeasure.INIT; ItemUnitOfMeasure.VALIDATE("Item No.","No."); //********Failed Here.................... ItemUnitOfMeasure.VALIDATE(Code,"Base Unit of Measure"); ItemUnitOfMeasure."Qty. per Unit of Measure" := 1; ItemUnitOfMeasure.INSERT; END ELSE BEGIN ItemUnitOfMeasure.GET("No.","Base Unit of Measure"); ItemUnitOfMeasure.TESTFIELD("Qty. per Unit of Measure",1); END; END;
Comments
This is just one example. You'll find many relation like this thru-out the database.
One approach is do design your import process to create the needed records in the supplemental tables as it loads the master tables.
It checks the IUOM table & if it doesn't already exist then it inserts just to get things rolling.
you can do something similar that works for you in an xmlport or as stated above..fill in the appropriate related tables first.
http://www.BiloBeauty.com
http://www.autismspeaks.org
Unit of Measure table is already filled (has all the valid UoM).
When I follow the above suggestion, I met with same kind of error due to the Table Relation and Validation codes in both tables.
I finally extracted IUOM from the Items to be imported and try to import using another XMLPort for IUOM table. Here too failed due to the above validation code reason.
I finally modified IUOM XMLPort to disable "FieldValidate" property of each field, and imported successfully. Then, the Items imported. At last, ran a process to VALIDATE Item No., Code and Qty... fields in IOUM.
Thank you again.