4 Replies Latest reply on Jun 17, 2011 11:32 AM by philmodjunk

    Portal Issues



      Portal Issues


      Hello all!

      I am building the contact management portion of my database and I want the ability to add multiple addresses.

      Rather than designating 5 fields for each location Home, Home2, Work, Work2, Vacation, Other, etc, I set up a child table "Addresses" with the following fields:

      • _fkContactID - Foreign Key
      • Type - This is where the user would specify, or select from a value list, the location (Home, Work, etc.)
      • isDefault - This field will designate whether this should be used as the default mailing address
      • AddressLine1
      • AddressLine2
      • City
      • State
      • Zip
      • FullAddressCalc - If ( AddressLine2 = "" ; Type & " > " & AddressLine1 & ", " & City & ", " & State & " " & Zip ; Type & " > " & AddressLine1 & " - " & AddressLine2 & ", " & City & ", " & State & " " & Zip )
        • This calcultion produces the full address string for use in an address list, (i.e. Home > 123 42nd St, New York, NY 10567

      I have all of these fields inside of a single row portal and I want to be able to add addiditional addresses, and edit or remove existing addresses.  I do not want the users to be able to scroll down in the portal or even know that it is a portal.  I will put a portal list below that will list the FullAddressCalc for all addresses related to that contacted.  Also if the user click on one of the address in the portal list, it should load up the data in the top portion for editing.

      Please let me know if you need further clarification and thanks in advance for your help.



        • 1. Re: Portal Issues

          Are you using FileMaker 11? I will assume so, but this method only works in 11. (A slightly different approach can be used for FileMaker 10 and older.)

          Add an AddressID serial number in your Addresses table if you do not already have one. Use Replace Field contents to update existing addresses with this serial number and also to update the next serial value setting at the same time.

          Define a portal filter expression on the upper portal:

          $$SelectedAddress = Addresses::AddressID or IsEmpty ($$SelectedAddress)

          Make your "portal list" a second portal, but without the filter.

          Use Button setup... to turn your calculation field into a button that runs this script:
          Set Variable [$$SelectedAddress ; Value: Addresses::AddressID]
          Refresh Window [Flush Cached Join Results]

          Now, when you click a row in the lower portal, the upper portal will update to display that address. You can also use conditional formatting to change the fill color of this calculation field in the lower portal to show which address line is currently selected if you want.

          I'd also write this script:

          Set Variable [$$SelectedAddress; value: ""]

          and use onRecordLoad to perform it so that each time you bring up a contact record, it defaults to the first record in your portal. If you sort your portal by IsDefault field in descending order, this triggered script will start you out with the default address each time.

          • 2. Re: Portal Issues

            Thanks Phil! I will try and get this working.  And yes I am using FileMaker 11.

            • 3. Re: Portal Issues

              Okay, everything seems to be working.  Couple of questions:

              1. What does Refresh Window [Flush Cached Join Results] do?
              2. The onRecordLoad you're referring to is in Layout Setup --> Script Triggers, or the portal Script Triggers?
              3. What script do I have to write for that "Save" button in order to commit that record and create a new record (Note: I only want the record to commit if the Save button is clicked, not merely by creation of a new record)?

              Thanks again,


              • 4. Re: Portal Issues

                1) It forces the filtered portal to update, so you need this to take place any time you change a value referenced in the portal's filter expression

                2) Layout setup.

                3) That would be difficult to do from a portal. It's just very easy to commit and save a portal record just by clicking on another part of the layout.

                You might need to define a set of global fields for adding addresses and then use scripts to move the data into a new related record (or update an existing record) when save is clicked. This would change the script to bring up an address--in fact you wouldn't need a portal at all for this in the top section as you'd now be using a series of Set Field steps to move address data in and out of your global fields.