2 Replies Latest reply on Dec 14, 2009 1:28 PM by TSGal

    Changing a Field Type

    Stonely

      Title

      Changing a Field Type

      Post

      I erroneously created a field for a date as a text field and want to change it to a date field without losing the dates already entered in the text field. All dates entered use slashes. If I change it to a date field, will I lose the data? If so, is there some way to do this?

       

      Thanks for any assistance provided. 

        • 1. Re: Changing a Field Type
          selfcreator
             Of course it won't lose data, but you should pay attention to the format. If the data format you input in the text field is not supported in the data field, this will cause that you can't new a record with your original date format of the text field. But at first you'd better make a backup of your file.
          • 2. Re: Changing a Field Type
            TSGal

            Stonely:

             

            Thank you for your post.

             

            The suggestion by "selfcreator" is definitely valid.  However, if there is some concern about losing data, then create an additional DATE field, replace the contents so the original information is intact, and compare.  Follow these steps:

             

            1. Create a new temporary date field named TEMP.

             

            2. In Browse Mode, show all records, place your cursor in Temp, pull down the Records menu and select "Replace Field Contents..."

             

            3. In the next dialog box, select the bottom option "Replace with calculated result".

             

            4. In the formula area, enter the name of the original text field that contains the date information.  Click OK.

             

            5. Click "Replace".  This will place all the contents from the text field into TEMP.  If you accidentally entered an invalid date, then the date will not display correctly.  Now, you can go into Table view and display just the text field and TEMP and compare.  When you see a difference, you can correct accordingly in both fields.

             

            6. When finished, you can either remove the original text field, OR.... if you already have layouts with this text field, change the text field to type Date.

             

            When finished, remove the field you no longer need.

             

            Let me know if you need clarification for any of the above steps.

             

            TSGal

            FileMaker, Inc.