Path: csiph.com!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: Helpful Harry Newsgroups: comp.databases.filemaker Subject: Re: How to Search for a Year in a Script Date: Fri, 20 Mar 2015 19:18:37 +1200 Organization: Aioe.org NNTP Server Lines: 82 Message-ID: <200320151918378956%HelpfulHarry@BusyWorking.com> References: <1m13hlr.134v3c4oahfczN%csampson@inetworld.net> <120320151830400933%HelpfulHarry@BusyWorking.com> <1m1hl39.1hp6kkr1njt975N%csampson@inetworld.net> NNTP-Posting-Host: mbEEXtHFaBhCqTzLPcB7hA.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], Charles H. Sampson wrote: > Helpful Harry wrote: > > > In article <1m13hlr.134v3c4oahfczN%csampson@inetworld.net>, Charles H. > > Sampson wrote: > > > > > > How do I execute a Find in a script to find records where a date field > > > has a specified year? Executing the Find manually, I'd just enter the > > > year in the date field (in Find mode), FileMaker would change that to > > > */*/year, and off we'd go. In my script, the year is in a local > > > variable, say $The Year. Constructs like Date ("*"; "*"; $The Year) > > > don't work. What to do? > > > > > > FileMaker is generally fairly forgiving about using the wrong data type > > in a field, but the exception is when performing Finds with Date or > > Time fields with the wildcard symbols ("*" or "@" or "!") in scripted > > finds simply doesn't work (at least in older versions of FileMaker, not > > sure about the newest versions). > > > > There's two methods to achieve what you want ... > > > > 1. Separate Year Field > > You can create a separate field which only stores the > > year as a number > > i.e. > > YearField = Year(DateField) > > and perform the scripted Find on that using the Set Field > > command > > i.e. > > Enter Find Mode [] > > Set Field [YearField, "2015"] > > Perform Find [] > > ... > > Something happened that caused me to overlook this reply. I've now > implemented a form of this, specifically > > Enter Find Mode [] > Set Field [Date; $Report Year] > Perform Find [] > Enter Find Mode [] > Set Field [Date Paid, $Report Year] > Extend Found Set [] > > This appears to be working. (I haven't done the necessary exhaustive > testing yet.) However, for some reason the script pauses at the Find and > Extend steps, displaying a Find Mode window with an active Continue > button. I haven't found a "Don't Pause" checkbox or anything similar > yet. > > I haven't digested the rest of your post yet, Harry. I might have > comments or questions on it when I do. If that's really your Script and doesn't have a typo when transferred to here, then it looks like there is a mistake in it. I'm not sure what you're trying to achieve but there are two Enter Find Mode commands and only one Perform Find, so that Script will finish still in Find Mode. If you are trying to find any records with Date = $Report Year or any records with Date Paid = $Report Year, then the Script should be something like this: Enter Find Mode [] Set Field [Date; $Report Year] New Record / Request Set Field [Date Paid; $Report Year] Perform Find [] As with manual Finds, the New Request creates an "OR" find (i.e. find records matching request criteria 1 OR records matching request criteria 2. By the way, it's probably not a good idea to have a Field named "Date" - it could be easily confused with the Date function. Helpful Harry :o)