10 Replies Latest reply on Oct 25, 2012 5:33 AM by mikebeargie

    Help with Loop Script steps (adding new records based on portal rows)

    dustyhanes

      Hello all,

       

      In summary, I am wanting to create new records based on the rows of a portal. If there are 10 rows of info in the portal, I want it to create 10 new records based on that info. I'm using FileMaker Pro 12.

       

      What I'm using this for is inventory for my small business. Each client I have has a certain number of our products that we use when we provide our service to them. I have a portal on each job's information record that shows a total of each kind of product used.

       

      The portal has 3 fields of information per row:

      1. Part #

      2. Description

      3. Quantity

       

      I have a layout called "Stock Transactions" that is used for inputting new records that either add or subtract inventory. For the purposes of this question, the Loop Script I want to create will only be subtracting inventory (basically just creating a record that puts the quantity in the (Units_Out) field of the Stock Transactions layout.

       

      The location of the button will not be on the same layout as where the portal is located, but both layouts are in the same table context.

       

      I want to create a button that, when clicked, creates new records in the Stock Transactions layout based on the information found in each portal row showing inventory needed for the job. In effect, when I click this button I am "checking in" a job as complete and removing the inventory used on that job from my current inventory totals. What makes sense to me is to end the loop when the next portal row is empty, so it can add as many records as there are rows.

       

      So I understand the concept behind a Loop Script, but need some guidance on the steps necessary to complete this task. Any and all help is appreciated, and let me know if you need more information than I have given. Thanks so much!