How to make a new sku if the product-id is new and go to related record if it product-id is already present
I am using a duplicate of my inventory table called Inventory 2 to check that a product-id exists already in my database. I want to add new skus if the product-id doesn't already exist. I have a script which checks the duplicate occurrence of the inventory, Inventory 2, and I want it to make a new sku if the product-id isn't already there. I thought my script, below would do that for me. If the product id is already there it adds the old sku. But I want it to make a new sku if the product-id is new.
Also if the product-id is already in the inventory I'd like my database to take me to the related record rather than allowing me to make a new record with the same sku.
Here is my script.
Set Field [Inventory 2::product-id ; Inventory::product-id]Set Field [Inventory::sku ; Inventory 2::Sku]Commit Records/Requests [No dialog]