3 Replies Latest reply on Mar 30, 2011 11:46 AM by philmodjunk

    Avoid duplicate in portal with auto update of the original record

    paolobkk

      Title

      Avoid duplicate in portal with auto update of the original record

      Post

      Hello everyone,

      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.

      Thanks

      Paolo

      FMPA 11 on Win 7 running from FM server 11 on Mac mini Server.

        • 1. Re: Avoid duplicate in portal with auto update of the original record
          philmodjunk

          That can be done. Self join relationships that match on the unique value field can be used to check for duplicates, but maybe there is a better way.

          What if the user filled in the info in some global fields and then clicked a 'save' button to add it to the table? The 'save' button's script could do a search for the record, if it finds one, it can update it with the new data (perhaps after showing the existing record and getting confirmation in case this is actually a mistaken entry.) If it does not find one, it can create a new record and move the data from the global fields to the newly created record.

          • 2. Re: Avoid duplicate in portal with auto update of the original record
            paolobkk

            I thought about the global field to fill and a second TO of Line_inventory_check for another filtered portal to show me eventual double entries. But I can't get the script steps to make it work.

            I got confused when is time to make it perform a find and get back to the right field of the portal with the IF script, or make appear the dialog box to set the quantities to add.

            • 3. Re: Avoid duplicate in portal with auto update of the original record
              philmodjunk

              I suggest breaking that down into sub projects and seeing where a problem is encountered.

              Can you get a script to find records using criteria entered in global fields?

              If that works, then you can use the data to create a new portal record. You don't actually have to set the script to interact with the portal, you can do all the work on a layout based on the portal's table (update the found record or create a new one), then switch back to the original layout. If you freeze the window, the user doesn't see the change in layouts take place.