2 Replies Latest reply on Mar 17, 2011 1:18 PM by MichaelVoccola

    New Record from portal



      New Record from portal


      I am working on a database that allows a user to create a list of items from an inventory for jobs. It is setup much like an invoice solution, this portion of the database including three main tables: job, line items, and inventory.

      I have a second table occurrence of "Inventory" labelled "Inventory 2"that allows a user to search the inventory (using a 'SEARCH' field in the 'job' table and filters in the 'Inventory 2' table with the appropriate relations). The results show up in a portal on the "job" layout.

      On another portion of the "job" layout, is a portal displaying the related line items (based off the job#).

      I would like a user to click a "+" button in the search portal, to create a new record in the "line items" table with the current job# and the item# from the related record in the portal row in which, the button was clicked.

      I  currently have the relationships working in such a way that a user can create a new line item by clicking in the last row of the line items portal, but am greatly struggling with a script / relationship adjustment that will allow the user to create a new line item by clicking a "+" button (and triggering the appropriate script in response) to add that inventory item.

      I could be completely overlooking something simple, but I am a fairly new one-man team and have been staring at this with no success; sort of feels like I'm looking everywhere for something that is in my hand.

      Any help would be greatly appreciated!

        • 1. Re: New Record from portal

          While it's possible to give your line items portal an object name, use go to object and go to portal row in your script to enter the data directly in the last, bottom row of the portal, I prefer this script:

          Set variable [$Job ; Value::inventory 2::JobNumb]
          Set variable [$Item ; Value::inventory 2::ItemNumb]
          Freeze Window
          Go To Layout [LineItems]
          New Record/request
          Set Field [LineItems::JobNumb ; $Job]
          Set Field [LineItems::ItemNumb ; $Item]
          Go To Layout [original layout]

          Subsitute your names for mine as needed.

          • 2. Re: New Record from portal

            Thanks Phil,

            I did have the first method you described working last night, but felt like it was a little gaff when I was using it. I did try the script you suggested, and it ended up working out great. I also inserted a custom dialogue that asks the user:

            "How many $equipname's would you like to add?

            There are X available for the selected dates

            Desired QTY: _____"

            Thank you again for the help!