4 Replies Latest reply on Dec 6, 2016 12:15 PM by David Moyer

    Global Date Field

    GJBDJC

      I want a user to be able to type in a month and date as follows:  12/2016

      From this I need a report to display: December 2016

      I attempted to use MonthName and YearName, but Filemaker will not let me use 12/2016 as a date?

      Any suggestions?

        • 1. Re: Global Date Field
          erolst

          You can't override the validation for a date field. But then, do you just want a calculated display, or does it have to be a date field?

           

          If the former, you can use an auto-enter calc with replace; if the latter, you need a script that is triggered OnValidation, like

           

          Set Field [ YourTable::yourField ; Let ( f = YourTable::yourField ; Replace ( f ; Length ( f ) - 4 ; 0 ; "1/" ) ) ]

           

          Format the date field to only display month name and year.

          • 2. Re: Global Date Field
            keywords

            One solution would be to have two fields, month and year, and then auto-replace the month using a calc to substitute: 1 > January, … 12 > December.

            • 3. Re: Global Date Field
              BruceRobertson

              You can set the field up to just be a full standard (global) date field.

              Though you enter a full date, FileMaker allows you to control the format of how that date displays.

              All the date fields below are the same field. The inspector has been used to control the display of the date.

               

              Screen Shot 2016-12-06 at 12.08.18 PM.png

              • 4. Re: Global Date Field
                David Moyer

                Hi,

                I played with the idea that you can format your date field with a custom date format:

                Then, to speed up data entry, I used an OnObjectKeystroke Trigger to add the day automatically (day 1).  So, typing "2/" will immediately become "2/1/".  Now, effectively, the user types "2/16" and the date will become 2/1/2016 upon leaving the field; and it will show as above if the field is formatted that way..

                 

                Here's the script behind the script trigger: