1 Reply Latest reply on Dec 26, 2012 10:32 PM by primaryquay

    Copying records from one table to another table.


      I have two tables, a Products table and an Inventory table. I want to copy over the some of the records in the products table to the inventory table. There are product records that are already in the inventory table that I don't want to duplicate and there product records that are not ready to go to inventory. I was going to mark the products that were ready to go inventory with a checkbox or fill a date field. What would be some suggestions on a good way to go about the copy process? Still getting my arms around FM, it seems like it should be a fairly straight forward process.


        • 1. Re: Copying records from one table to another table.

          I will assume you only want one (and only one) inventory record for each product record:


          Establish a relationship from the Product table that allows creation of records in the inventory table - use the product code as the link.


          Create a script to loop through your products, where the product is active, set the inventory values using the relationship.


          Eg update the next shipment date:


          Go to Record [First]



            SetField(product_INVENTORY::NextShipmentDue; Product::NextShipmentDue)

          End If

          Go to Next Record  (Exit After Last)

          End Loop


          This will create a new inventory record if the product is available and no inventory record exists.

          If one exists, it will overwrite the existing value.