Avoid duplicate in portal with auto update of the original record
I have 2 related tables: 1 with the date and ID of the inventory (Inventory check) and another with all the info for each product (line inventory check).
In the layout of the table "Inventory check" I set up a portal from "line inventory check" with a field (code_products) where the user can select a code from a drop down value list with all the products codes and another field to add the number of items in inventory.
I also made an autoenter calculation field in "line inventory check" (code_products & IDinventory) with a validation as "unique value", In this way the same products will not be committed twice in the same inventory day.
The problem is that when this happen, the user must scroll all the portal looking for the product already committed in order to update the quantity, or he must go to the layout of "line inventory check" and perform a find for that product within the same inventory ID.
I'm trying to make a script triggered from "object exit" in the code_products field of the portal that will check for duplicates (maybe using the field "code_products & IDinventory") and in case the item is already in the list will pop a dialog box where the user will insert the number of items to add for that product.
I've being considering global fields and variables but I still can't find the right way to make it work, any suggestion is greatly appreciated.
FMPA 11 on Win 7 running from FM server 11 on Mac mini Server.