Path: csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: Helpful Harry Newsgroups: comp.databases.filemaker Subject: Re: Date Comparison Again Date: Sun, 08 Nov 2015 12:40:38 +1300 Organization: Aioe.org NNTP Server Lines: 40 Message-ID: <081120151240387871%HelpfulHarry@BusyWorking.com> References: <1mdhq3t.mfhgwyznp5slN%csampson@inetworld.net> NNTP-Posting-Host: U4um5itpdkF5Q9i2T98g9g.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Thoth/1.8.4 (Carbon/OS X) X-Notice: Filtered by postfilter v. 0.8.2 X-Face: vIZzK[X\z-._]-_:U?l@cBtwg<{a>ggn\mH}Vs>38E,#R%7h%U0'=4;1Q=erO %[T#a{YJfGvAbWmE@f_h], Howard Schlossberg wrote: > On 11/7/2015 12:44 AM, Charles H. Sampson wrote: > > > > I start out the script with the following: > > > > Set Variable [$StartupDate; Value:Get(ScriptParameter)] > > Set Variable [$ThisDay; Value:Day ($StartupDate)] > > Set Variable [$ThisMonth; Value:Month ($StartupDate)] > > Set Variable [$ThisYear; Value:Year ($StartupDate)] > > > > Subsequent custom dialogs indicate that these four values are what I > > expect. Comparisons of this date to other dates don't work. (I'll supply > > more detail if needed.) > > > > Here's the new piece of information. If I follow the first Set Variable > > above (Get(ScriptParameter)) with > > > > Set Variable [$StartupDate; Value:Date (Month ($StartupDate); > > Day ($StartupDate); Year ($StartupDate))] > > > > the script now works. Probem solved? Maybe so, but I'd like to know why > > implicit type conversions appear to work sometimes and don't in others. > > My guess is that the day, month and year functions tell FileMaker that > the input is to be treated as a date, so that any text input (which is > ALL a script parameter is) is first converted to a date automatically so > that FM can get the day, month or year. > > To fix your problem, just change the first step to: > > Set Variable [ $StartupDate; Value: GetAsDate( get(scriptParameter) ) ] Unlike many programming languages, FileMaker is pretty forgiving about mixing data types ... *BUT* dates and times do seem to be more picky than numbers and text. Possibly that's at least partly due to the various different formatting dates can have (i.e. DD/MM/YY or MM/DD/YYYY or DD MMMMM, YYYY, or DD.MM.YYYY, etc.) Helpful Harry :o)