4 Replies Latest reply on Oct 1, 2013 7:32 PM by CarlSchwarz

    Date conversion problem


      For a find I use "Insert calculated result" to insert a date range if required into a date field for a search.

      This has worked fine for me in the past in FM11.

      However now I'm using FM12 and perhaps this problem is FM12 related or perhaps it's this server setup.


      The problem is I use a global date field to pick a date, I then script

      Insert Calculated Result [ getastext(search date) ]

      The getastext script step is returning the American date format and it's making this search fail because the file is set to use the Australian date format! A dialogue box appears asking for the correct date format to be entered.


      Has anyone come across this before? Is there a server setting I need to change?

        • 1. Re: Date conversion problem

          I unhosted the file and it still happens.  The problem isn't with the server.

          I use the "Set Use System Formats" script step to set the date format to the local date when the file is opened.

          • 2. Re: Date conversion problem

            Try Set Field [ date ; search Date ] instead.

            • 3. Re: Date conversion problem



              The suggestion above to use set field will likely work for you. It is always best to avoid manipulating dates by putting them through a "getastext" process, as this does trigger system date options, which as you've discovered, can change arbitrarily. The set field process is "better" also in that it will always work if you are on the correct table; the insert calc result requires that the specified field by on the active layout.

              • 4. Re: Date conversion problem

                Thanks!  In the past (FM11) I had problems scripting date ranges into a date field in find mode using 'set field' because it would complain that the eliipses (...) was not a valid date and using Insert Calculated Result would work around that!

                I'm glad that set field is working. And thanks for pointing it out,  I shouldn't have assumed that set field would fail.