6 Replies Latest reply on Feb 21, 2010 6:02 PM by RickWhitelaw

    Newbie Script question



      Newbie Script question


      Hi all,


      I am new to FileMaker and I am having troubles figuring out exactly how scripts work.


      What I would like to do is create a unique name identifier, last&first&sequential_number.  So the first guy entered named Joe Smith is smithjoe1, the second is smithjoe2.


      Here is my thinking my layout has First Name then Last Name being entered.  After entering last name, I would like to trigger a script that does this:


      Search the database to see if firstlast1 exists

      if not, this is a new name, continue on


      if it does exist, I would like a pop-up layout listing all the current firstlast records,  from this list, I can either choose 1, or create a new record.  Either I am not looking in the correct place for the scripts, or what I am seeing is not allowing me to write this type of script.  


      How can I accomplish this?

        • 1. Re: Newbie Script question

          Why not a unique serial number? Unrelated to first and last name?

          One assumes there is a reason. 

          • 2. Re: Newbie Script question

            The person entering the name is not going to know the serial number, and the name may already exist.  If it exists, I would like the information associated with that record to be pulled up.



            • 3. Re: Newbie Script question
              Steve Wright

              So what happens when...


              1. The name is spelt wrong and needs correcting.

              2. A female for instance gets married and the surname changes


              Using this method you are going to end up in a huge mess, if not soon, eventually !

              All related records will be lost / unlinked if you change the name



              • 4. Re: Newbie Script question

                "The person entering the name is not going to know the serial number, "


                The person entering the data should NEVER know, or have to know , the serial number. It's auto-entered and has absolutely no other meaning. It never is seen on a layout, unless for you to "test" temporarily. Match fields really must be foolproof. Names, as already mentioned, are not unique, and do change. With a serial match field, if a person changes his/her name, you could simply bring up the record and change the name. That record would still retain any relationships previously established.



                • 5. Re: Newbie Script question

                  I can understand the need to use serial number as the unique key.  That makes a lot of sense.  What I am struggling with is how do I prevent from entering a duplicate record.


                  What I would like is a FIND layout to enter First and Last name

                  If records are found, display a Layout listing names and some other identifying field like phone number

                  If not, then go to the Data Entry Layout screen


                  I am trying to use a Script Trigger on exit of  Last Name  todo a Perform FInd, but the syntax for this command does not appear to allow me to do what I want.  Is there a better way to do this?

                  • 6. Re: Newbie Script question

                    Script Triggers trigger scripts . . . so, if you can write a script that does what you intend (Enter find mode, set field, perform find etc.) then it can be triggered as you suggest.