3 Replies Latest reply on Sep 18, 2013 9:13 AM by philmodjunk

    Add Record to Portal via checkbox or button

    DarrenHorsley

      Title

      Add Record to Portal via checkbox or button

      Post

           Hi...

           I hope someone can help out.  I have a small project that i'm basing off the Estimates sample provided with FMP 12.  In the Estimates Sample you can add line items (products) to the Estimate Cost portal by either clicking on a new line or using the Add Line Item button.

           I would like to extend this further by having a series of checkboxes and text fields (which are calculations based on other fields) that are some how linked to a single product (item) and when a user clicks the checkbox or button or the text field is updated the associated product is then added to the Estimate Cost portal.

           Hopefully some is able to help on this?

           Thanks

        • 1. Re: Add Record to Portal via checkbox or button
          philmodjunk

               This can be done, but the ideal implementation is not a simple as you might like. By "ideal" I mean a method where the choices you make by clicking check boxes do not interfere with the selections made on a different estimate.

               I have a demo file for many to many relationships that includes such a check boxes interface as one of the layout design options that you can use. The check boxes are not actual check boxes, they are a combination of a rectangle graphic object and conditionally formatted layout text setup as a button that performs a script that either adds a record to the Join table (item is selected) or deletes such a record (Box is clicked a second time to clear the selection.)

          https://www.dropbox.com/s/oyir7cs0yxmbn6i/ManyToManywDemoWExtras.fp7

               If you are using FileMaker 12, open this file from the Filemaker File menu to get a converted copy that you can open and examine.

          • 2. Re: Add Record to Portal via checkbox or button
            DarrenHorsley

                 Thanks for the reply. I have had a look at you example and helps a little.

                 From your example I would have to modify the script to contain all the variables to populate the portal. Is this correct?

                 Is there any other way this could be done?

            • 3. Re: Add Record to Portal via checkbox or button
              philmodjunk
                   

                        From your example I would have to modify the script to contain all the variables to populate the portal. Is this correct?

                   I have no idea what you mean by that. What "script"? what "Variables"?

                   The example uses a portal to all Events using the X operator. No script is used to produce that result. The only script is the one that either adds or removes a record from the related table, which for demonstration purposes, is displayed in the second portal on that layout.

                   I would assume that you have these tables/relationships though I am simply guessing the names you may have used:

                   Estimates----<LineItems>-----Products_Services

                   Each time you start an estimate, you create a new record in Estimates. To list each product or service covered in that estimate, you create a record in LineItems and select the ID of the appropriate record in Products_Services.

                   To produce a check boxes format, you add a new Tutorial: What are Table Occurrences? of Products_Services and link it to Estimates with a relationship that lists the records in Products_Services that you want to appear in the checkbox list. If you want to list all Products_Services, you'd use the X operator in the relationship like my demo file, but this is not the only option and a portal filter may also be used to control what items appear in the portal.

                   Then, clicking the "check box button" in the portal to this occurrence of Products_Services runs the script from my demo file. It checks to see if such an ID is already added as a record in LineItems for this estimate. If one has been added, it deletes the record (clearing the check box selection.) If such does not exist, it adds a new record in LineItems (selecting that item for the estimate). Where such an approach get's complicated is if you also need to specify a quantity or other data affecting the total estimate cost for items that you have selected.