1 Reply Latest reply on Aug 3, 2015 10:40 PM by philmodjunk

    Simplest Way to Add Record to Table from another Layout

    DanielSiegel

      Title

      Simplest Way to Add Record to Table from another Layout

      Post

      I have what I suspect is a very simple question, but am new to FileMaker.

      I understand how to create a Conditional Value List (eg, this link below) for creating a Relationship between Fields in 2 tables, and then creating  Layout with 2 popup fields -- one tied to a 1st Value List (eg, to select a Category from all records in a Table) and a 2nd tied to a conditional Value List (to select items based on the first Category selection)

      http://help.filemaker.com/app/answers/detail/a_id/5833/track/AvNGyQqzDv8S~WqvGoYc~yJf8~cq7y75Mv_f~zj~PP9W

      However, I would like to allow users to Add a Category (or an Item) to the actual Table if they dont appear on their respective List.  I edited the Relationship to indicate that it could Add items to the Table, and edited the fields to allow for manual input of an "Other" item instead of selecting one from the popup lists.

      But neither of these actually Added a Category or Item to the underlying Table.

      Does someone know a simple (ie, no scripts, SQL, etc) way to allow a User to select items from these Lists, but to also Add an item (to the underlying Table) if the desired entry isnt currently in the Lists (ie, not yet in the underlying Table from which the Lists are generated)?

       

        • 1. Re: Simplest Way to Add Record to Table from another Layout
          philmodjunk

          Developing a FileMaker Database without scripting is like rowing a row boat with only one oar.

          The "allow creation..." option makes it possible to use the relationship to add related records. It does not make it an automatic process. If you had a portal to the table of values, "allow creation" would allow you to add a new record and thus a new value to your list by entering data into a field of the blank "add row" that appears in a portal when you enable that relationship option. Such a portal could be hidden inside a popover.

          But here's a simple script for adding a related record. While the script changes layouts, the user does not see the change take place:

          Set Variable [$ID ; LayoutTable::PrimaryKey ]
          Go to Layout ["relatedtable" (relatedtable) ]
          New Record/Request
          Set field [RelatedTable::ForeignKey ; $ID ]
          Go to Layout [Original Layout ]

          You may find the following two demo files to be helpful. The first illustrates 10 different ways to set up a conditional value list. The second explores options for selecting values when a value list, conditional or otherwise, isn't enough to get the job done.

          They are free to download.

          Adventures in FileMaking #1 - Conditional Value Lists (includes details on how to set up a basic field based value list)
          Adventures in FileMaking #2 - Enhanced Value Selection (what to do when a simple value list won't cut it.)

          Caulkins Consulting, Home of Adventures In FileMaking