1 Reply Latest reply on Apr 27, 2014 8:20 AM by philmodjunk

    Help with Portal display/relate with a checkbox

    user22711

      Title

      Help with Portal display/relate with a checkbox

      Post

      I need some help on a portal display solution. There are two related tables, Products and Locations using location name as a match field. Looking for a graceful way for users to assign them to one another (for example Postcards & Business Cards are available from the California and New Jersey, but not Colorado printing location) using a portal. What I am looking to do is on the layout/form for setting up the product, is show each location in the portal with a checkbox for assignment. I'm currently using a relationship that allows for creation of each related location record and uses a drop down for the location ID and a lookup for the location name. It works fine but a user can assign a location twice as it is setup now. I'd be grateful for any direction on how to set up the portal so all of the available locations are listed and a checkbox assigns the actual relationship.

      Capture.PNG

        • 1. Re: Help with Portal display/relate with a checkbox
          philmodjunk

               It's possible that what you need here is a join table to facilitate a many to many relationship. A product can be available at multiple locations and a location can list multiple products. Assuming that you need to record more info than just the name (and maybe an ID) in the location table...

               Start with these relationships:

               Products-----<Product_Location>-----Locations

               Products::__pkProductID = Product_Location::_fkProductID
               Locations::__pkLocationID = Product_Location::_fkLocationID

               You can place a portal to Product_Location on the Products layout to list and select  Locations records for each given Products record. Fields from Locations can be included in the Portal to show additional info about each selected Locations record and the _fkLocationID field can be set up with a value list for selecting Locations records by their ID field.

               With such a set up, it is then possible to set up a portal to an additional Tutorial: What are Table Occurrences? of Locations with buttons that select/deselect a location by adding or deleting records from Product_Location--just like a check box. Conditional formatting (and possibly FMP 13's new "hide object when" property) can make this button look and change appearance just like a check box.

               This demo file has an example layout that uses this method: https://www.dropbox.com/s/oyir7cs0yxmbn6i/ManyToManywDemoWExtras.fp7