1 Reply Latest reply on Nov 2, 2011 9:34 AM by philmodjunk

    Two portal setup help

    user17056

      Title

      Two portal setup help

      Post

      Short version of problem: I'd like to have two portals, for two related records, and be able to enter data into the second portal based on the current record of the first.

      An over-simplification of the database setup is Things Acquired ---< The Thing ---<Details about Thing. Things Acquired has fields ID (auto incremented) and Date. The Thing has fields Record ID and Thing ID (auto incremented). The Thing is related to Things Acquired via ID/Record ID. Details has fields Thing ID, Detail ID (auto incremented) and Detail Info. Details about Thing is related to The Thing via Thing ID/Thing ID. Allow create/delete is enabled on all downstream relationships.

       

      My problem:

      I have yet to figure out a way to put two portals, one for The Thing and one for Details about Thing, on a form and get the second to update along with the first. I can get the first to update the records fine. Each time I move to a new row on the portal a record is created. The second portal, however, keeps creating records based on info from the first record of the first portal. Meaning that I can enter 50 records in The Thing, and there will be 50 unique Thing IDs, but all records in Details about Thing will point to Thing ID #1.

      What I want is that, after entering info in the second portal and moving to a new line on the first portal, the second portal saves the current record, creates a new record (based on the first portal's values), and clears the portal for new data entry.

      After searching through the forum, and google, I'm fairly certain that there is a way to make this work; I'm just not sure how. Any pointers to a solution would be greatly appreciated.

      I'm using FileMaker Pro 11.

       

       

       

        • 1. Re: Two portal setup help
          philmodjunk

          I think your efforts to simplify have clouded things up a bit.

          You've describe these relationships:

          ThingsAcquired::ThingID = TheThing::ThingID
          TheThing::ThingID = ThingDetails::ThingID

          The names of your tables suggest that ThingID is an auto-entered serial number defined in TheThing. The relationship sketch you posted:

          Things Acquired ---< The Thing ---<Details about Thing

          Suggests that ThingID is auto-generated in Things Acquired. (usually, ---< means "one to many".)

          WIth scripting, the "synchronized detail portal" is possible to set up, but we first have to clear up the relationships used. I'm going to switch to table names that work for me:

          Invoices---<LineItems----LineItemDetails (Just name changes so far, but watch how the relationships differ...)

          Invoices::InvoiceID = LineIteims::InvoiceID
          LineItems::LineItemID = LineItemDetails::LineItemID.

          With this change in place, I can add a different table occurrence of LineItemDetails and link it directly to invoices:

          Invoices::gSelectedLineItemID = SelectedLineItemsDetails::lineItemID

          Make gSelectedLineItemID a field with global storage if this database will be hosted over a network with multiple users. Enable "Allow creation of records via this relationship" for the SelectedLineItemsDetails table occurrence.

          Now you place a portal to SelectedLineItemsDetails next to your LineItems portal and specify the OnObjectEnter script trigger for the LineItems portal. It should run a script like this:

          Set Field [Invoices::gSelectedLineItemID ; LineItems::LineItemID]

          Now clicking in a field in LineItems, brings up any existing detail records for that line item in the portal. And you can add new detail records in this portal just by entering data into the blank "add" row of this portal.