Date Arithmetic
23 Sep 2009 Leave a Comment
in Script Step
Here is one way to get a new date from the date field d of table t, for instance, the date which is 1 year and 180 days later (in this simplified example the field to be set is unspecified):
Set Field [ Date ( Month ( t::d ) ; Day ( t::d ) + 180; Year ( t::d ) + 1) ]
Also, FYI:
Tests of entries into three different fields of type Date, Time, and TimeStamp, respectively:
command-dash in a Date field enters the current date.
command-dash in a Time field sounds a beep.
command-dash in a TimeStamp field enters the current date, then a warning message on commit.
Insert Current Date enters the current date into a Date field. Into a Time or TimeStamp field, however, Insert Current Date enters the current date, then a warning message on commit.
Set Field [Get (CurrentDate)] enters a valid result, albeit midnight, into the TimeStamp field. Into a Time field, however, the result is a strange entry (e.g., 17608092:00 AM).
Set Field [Get (CurrentTime)] enters the wrong date into the Date field. (In this test case it was yesterday’s date that was entered.)
Set Field [Get (CurrentTime)] entered the correct time but wrong date (e.g., 1/1/0001 11:05:09 AM) into the TimeStamp field.
Set Field [Get (CurrentTimeStamp)] enters valid results into all three field types.
In a calculation field for a date result, adding or subtracting whole numbers from a date field returns a date so many days ahead or behind, respectively. Likewise, in a calculation field for a Time or TimeStamp result, adding or subtracting whole numbers returns a time so many seconds ahead or behind.
Using Set Field to add or subtract whole numbers to change days in Date fields or seconds in Time or TimeStamp fields works as well.
Get ( LastMessageChoice )
27 Aug 2009 Leave a Comment
in Dialog Box, Function, Script Step
So, if the Get function in the above conditional gets the value of the LAST message choice why is there no Get ( MessageChoice ) function?
Wouldn’t a Get ( DialogChoice ) function make more sense, since the value is harvested after the Show Custom Dialog script step. It would be easier to find in that list of functions.
Also, note how the options dialog box adds to the confusion

because 1) Button 1 is labeled Default Button and 2) the numbering is from left to right, where in the actual box those buttons are arranged from right to left:
P.S. The convention in the computer world is to start counting from zero. It is not beyond the capability of script writers to learn that fact!


