2 Replies Latest reply on Mar 11, 2013 9:00 AM by philmodjunk

    Puzzled

    jb362

      Title

      Puzzled

      Post

            

           Goal: to update a Date field via a script.

           What happens though is that after the script below completes the date field, which had a value earlier, is now left blank/empty.

           ...

           Set Variable [$DateMetersRead; Value: 03-01-2013]

           …

           …

           Set Field [Utilities::Date Meters Read; $DateMetersRead]

           I'm just a hobbyist, but what am I missing?

           Thanks.

        • 1. Re: Puzzled
          Jade

               Hi Jerry,

               You are trying to stuff a variable containing a text string ("03-01-2013") into Utilities::Date Meters Read that you have defined as a date field.

               If "03-01-2013" is in your system's date format, try this instead:

               Set Variable [ $DateMetersRead ; Value: GetAsDate("03-01-2013") ]

          • 2. Re: Puzzled
            philmodjunk

                 Actually 03-01-2013 without quotes would be interpreted by FileMaker as a math problem: 3 subract 1 subtract 2013. The - characters will be interpeted as the subtraction operator. wink

                 As Jade has suggested, GetAsDate is one way to get around that detail.

                 Date ( 3 ; 1 ; 2013 )

                 would be another way of getting the same result.