2 Replies Latest reply on Feb 10, 2009 1:53 PM by retired

    Entering default value on new record creation?



      Entering default value on new record creation?


      When entering a new record I need set a default value to three different fields. Two of these I have accomplished with short scripts but the third has me stumped.  I need to add "Active" to a field named 'status'  I have tried the Insert Text script but must be doing something wrong as it does not work.  Using FMP 10 - it writes the script as

      Insert Text [Select; members::member_status["Active"]]

      The Script Reference pdf shows the syntax as

      Insert Text [Select; members::member_status; "Active"]

       If I try to enter per the reference I get error saying the [ is expected.

      When I run the script as FMP creates it nothing happens.

      I have also tried the Set Field but that does not work either - I assume since there is no calculation involved.

      It's been almost 30 years since I've done any programming so I will appreciate all help. 

        • 1. Re: Entering default value on new record creation?

          howdy retired,


          Welcome to the forum, thanks for the post, wish I was retired too...(and it's always a plus to find a programmer from 30yrs ago).


          Two things to think about:


          1. Instead of using a script, why not autoenter the data?  File>Define>database, select your field and double-click and you should get some autoenter options.  Use these to set default values instead of scripts.


          2. If you must use scripts (or feel more comfortable with them), its OK.  Instead of using "Insert Text", use "SetField" instead.  And drop the excess [].


          Setfield doesn't require it to be a calculation...in the calculation box just type:




          with the double-quotes.


          Does that work for you or did I miss something?

          • 2. Re: Entering default value on new record creation?

            I chose to use your first option  -- THANKS.


            I did try the Set Field as you suggested however version 10 will not let me write it with the ; and not the[].  And with the [] it does not work.