5 Replies Latest reply on Nov 11, 2014 8:53 PM by bantotang

    auto add records

    bantotang

      Title

      auto add records

      Post

      hello.

      I have hit a blank wall. I can't go anywhere. I know it can be done. I'm trying to search the forum but I don't know what to search for this problem

      I have different groups (bshrm, bscoe, bsba, bscs, etc).

      I have a portal that adds billing for each student, The total records of the database are at around 5,500, the bshrm are 2,500, the bscoe are 300, and so on.

      After using the Find bshrm, I can add billing individually to the bshrm group no problem, but it is too prone to errors and too tedious to add one by one.  I need to automatically fill up the billing fields (billing line item (is drop down), billing particulars, details, quantity amount, total_amount) all with the same data throughout the group. And different data for different groups. I don't need to append the existing one. I want it to add a new record, so that the billing number is also updated. Billing is from the billing_Fees table.

      I hope i made myself clear. English is not my first language.

      Thanks a lot.

      Snap1.png

        • 1. Re: auto add records
          bantotang

          here is my relationship.

          • 2. Re: auto add records
            philmodjunk

            Which version of FileMaker are you using?

            Your layout would appear to be based on Students.

            On which of the 7 table occurrences shown is the portal based? Invoices? Billings? or one of the ones with "Lines" in the name?

            It's possible to set up some global fields where you specify the data common to all the new portal records and then a script can loop through your found set of records to create one related record for each using both data from each record in term, (Student_Id) and data from the global fields to create those records.

            The best script for that can depend on whether you are using FileMaker 13 or an older version as there's a new type of summary field that can make the script a bit simpler than methods that work with older versions.

            • 3. Re: auto add records
              bantotang

              hello,

              I'm using FMp12. The layout is based on Billings, for me to get the _kp_Billing_Id. The portal is based on Billing_Lines which is my Join table.

              Sorry, i did not make myself clear on the first post. I add records in the Billing_fees. which is the first filed in the portal. it will automatically populate the other fields. What I need to do is add records for each student on the found set or group like BSHRM with the selected Billing_Lines::_kf_Bill_items_id.

              I hope I made myself clearer this time.

              Thanks.

              • 4. Re: auto add records
                philmodjunk

                Put a button inside your portal row to perform this script. You will select a value for kf_Bill_Items_id in the portal and then click this button in the same portal row to do this:

                Set Variable [$Bill_Item ; value: Billing_Lines::kf_Bill_Items_id ]
                Commit records
                Omit Record ---> this keeps the current record from getting this item added a second time by the script
                go to Record/Request/Page [first]
                Freeze Window
                Loop
                    Set Variable [$BillingID ; value: Billings::kp_Billings_id ]
                    Go to layout ["Billing_Lines" (Billing_Lines)]
                    New Record/Request
                    Set Field [Billing_Lines::kf_Billings_id ; $BillingID ]
                    Set Field [Billing_Lines::kf_Bill_Items_id ; $Bill_Item ]
                    Go to Layout [Original Layout]
                    Go to Record/Request/Page [Next ; exit after last ]
                End Loop

                Caution: the layout changes in this script can trip any number of scrip triggers that will then pause this script to run the trigger performed script before resuming this script. That interference can keep this script from producing the expected results. There are ways to keep this from happening by setting a global variable to a value and setting up all trigger performed scripts to check for this variable before doing anything.

                • 5. Re: auto add records
                  bantotang

                  That works, Thank you very much.