10 Replies Latest reply on Nov 27, 2009 11:52 AM by DrDave

    Default value setting.

    mayor

      Title

      Default value setting.

      Post

      How to setup default value for certain field. Let say I have 1 table as below:

       

      Order (order_id, order_date, status ...)

       

      How to make default value for order_date is current date and

      default value for status is accepted.

       

      Your help much appriciated!

       

      TQ

        • 1. Re: Default value setting.
          LaRetta_1
            

          Use your auto-enter settings for both.  On Order date, set your auto-enter date to creation date.  And set the status to enter 'data' and just type Accepted in the box.


           

          • 2. Re: Default value setting.
            mayor
              

            I found auto-complete but I didn't find auto-enter function? FYI, both field (order_date & status)

            using drop-down list. Please help.

             

            TQ

             

            • 3. Re: Default value setting.
              LaRetta_1
                

              Go to File > Manage > Database.  Select your Fields tab and select your OrderDate field.  Bottom right button called Options.  First tab is Auto-Enter.

               

              You can set both fields here to auto-enter creation date (for Order Date ) and status of Accepted but Users can still change these settings.  All it means is that, when the record is first created, it will inherit these defaul initial settings.

              • 4. Re: Default value setting.
                mayor
                  

                Thanks a lot, I got it.

                 

                TQ

                 

                • 5. Re: Default value setting.
                  DrDave
                    

                  I'm having a problem here...using v10 FMP.

                   

                  I create a text field and on the Auto-Enter screen, I check "Data" and enter an N (I tried with and without quotes), but when the field is first created, the default value is blank.

                   

                  I also tried on the same screen to enter the Calculate function and specified "N" to same result.

                   

                  What am I missing?  

                  • 6. Re: Default value setting.
                    LaRetta_1
                      

                    DrDave wrote:

                    I create a text field and on the Auto-Enter screen, I check "Data" and enter an N (I tried with and without quotes), but when the field is first created, the default value is blank.


                    Hi DrDave, auto-enter data fires when the record is created and not when the field is added.  Does it produce N when you add a new record?


                    • 7. Re: Default value setting.
                      DrDave
                        

                      Looking sheepish....

                       

                      I see how that works and yes, when a new record is created, the specified data value is included.

                       

                      I realize too that if I'm creating a new field, then after it's created, I can place my cursor on the field, enter a value, then Cmd= (on a Mac) and then, replace all.

                       

                      Now that I think about it, it would be a nice FM option -- when creating a new field, add it's default value.

                       

                      Thank you for the feedback.

                      • 8. Re: Default value setting.
                        LaRetta_1
                          

                        DrDave wrote:
                        Now that I think about it, it would be a nice FM option -- when creating a new field, add it's default value.

                        Well actually you can (so to speak)...

                         

                        When you create your new text field, make it a calculation first.   Type your text value (or calculation) into the calculation dialog and set the result to text (or whatever you need).  Leave storage options on the new field as is.  Say OK to exit calculation and OK again exit field definitions.

                         

                        Then go back into field definitions and change the field to standard text (and apply your auto-enter text or re-select the auto-enter calc).  When you exit out of field definitions, the value will implant into the field itself.  Always back up first; this process will not work if the calculation is unstored. 

                         

                        UPDATE:  This is a quick (developer) technique for mass-changing data within fields without the need to return to the layouts, show all records and so forth.  Once you understand (and become confortable) with this process, it wll be quite valuable.


                        • 9. Re: Default value setting.
                          LaRetta_1
                            

                          LaRetta wrote: 

                          Then go back into field definitions and change the field to standard text (and apply your auto-enter text or re-select the auto-enter calc).  When you exit out of field definitions, the value will implant into the field itself. 


                          I do want to clarify that the data will plant into the field even if you don't 'apply your auto-enter text or re-select the auto-enter.'  I meant that you should re-set the field however you want it to continue after you are done manipulating the data. 

                          • 10. Re: Default value setting.
                            DrDave
                               That makes sense. Thank you