2 Replies Latest reply on Nov 15, 2016 9:51 AM by oumayma

    create new record in pop up message

    oumayma

      i have project layout and i need to create new record for person in the same layout he have just first name and last name

      how i can that

      Knowing

      project is a table

      and person is a table

        • 1. Re: create new record in pop up message
          philmodjunk

          If you don not provide more information, we either cannot provide assistance or we have to make guesses as to the details you did not share. If I had not recognized you from previous posts that touched on this issue, I would not have any clue as to what you are asking.

           

          I will guess that you have this relationship:

          Project::__pkProjectID = Person::_fkProjectID

           

          This could be a bad way to set up relationships, but I will use this to illustrate the basic concept:

           

          If you open a custom dialog with input fields or use a popover (I'd use a popover), with a text field for the person's name, you could do this:

           

          Make the text field for the person's name used in this dialog or popover a global text field.

          This script can then be run when you click a button in the custom dialog or popover:

          Set Variable [$ProjectID ; value: Project::__pkProjectID ]

          Go To Layout ["Person" (Person) ]
          New record/request

          Set Field [ Person::_fkProjectID ; $ProjectID ]

          Set Field [ Person::Name ; AnyTable::GlobalNameFieldHere]
          Go to Layout [Original Layout]

           

          This is the simplest method for creating a new record in Person that is also linked to the current Project record. There are other options that work better, but this is a simple, beginner level approach. To create such a record without changing layouts in the script, do a web search for the keywords: FileMaker MagicKey.

           

          And I suspect that you really need three tables, not two as I would guess that you need to assign the same person to more than one project and more than one person to any given project. If so, you have a many to many relationship and you need a join table between Project and Person to facilitate that many to many relationship.

           

          Projects---<Project_Person>------Persons

           

          Projects::__pkProjectID = Project_Person::_fkProjectID

          Persons::__pkPersonID = Project_Person::_fkPersonID

           

          Every time you add a person to a project, you create a record i Project_Person to link the current project to the selected person.