Path: csiph.com!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: Helpful Harry Newsgroups: comp.databases.filemaker Subject: Re: Using Variables in Find Requests Date: Wed, 27 Nov 2013 18:50:08 +1300 Organization: Aioe.org NNTP Server Lines: 56 Message-ID: <271120131850081927%HelpfulHarry@BusyWorking.com> References: <0001HW.CEBA50E9028DAA5BB02919BF@news.astraweb.com> NNTP-Posting-Host: UIha/K6VIb4mwihG7DRvmw.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.5.4 (Carbon/OS X) X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.databases.filemaker:1542 In article <0001HW.CEBA50E9028DAA5BB02919BF@news.astraweb.com>, Nelson wrote: > I am trying to write a script to find records between two dates, say > 1/1/2013 and 2/1/2013. The fields which specify the two dates are in a > different table from the records I am trying to search so I am using > variables in the script to save the values while I change to to the > table/layout that contains the target records. > > First, I set $Start to 1/1/2013 and $End to 2/1/2013 and then switch to > the target layout and enter $Startä$End in the date field of the find > request script step. When I try to execute the find, I get an invalid > field error. Using the script debugger I can see that the date field > contains the sting "$Startä$End" instead of "1/1/2013ä2/1/2013". The > same thing happens with ">$Start" in the request field. Curiously, > however simply entering $Start in the request field works. > > Here is the script: > > Set Variable[$Start;Value:Billing Periods::Start Date] > Set Variable[$End;Value:Billing Periods::End Date] > Go to Layout["Combined Call Log" (Call Log)] > Enter Find Mode[Restore] > (Note: "Date" Request field set to $Startä$End) > Perform Find[] > > > Is this a known bug or am I missing something? > > Thanks. I see from later messages that you've solved the problem, but just as an aside ... Since you're scripting the find, I would personally not use the Restore option for the Enter Find Mode command. Instead, get the Script to enter the required Find data into the field itself. This makes it easier to see what the Script does (if you come back months / years late, for example) and to make it easier to alter in the future. (Note: Since I have never used variables, I'm not sure of the format for using them in the Set Field command) e.g. Set Variable[$Start;Value:Billing Periods::Start Date] Set Variable[$End;Value:Billing Periods::End Date] Go to Layout["Combined Call Log" (Call Log)] Enter Find Mode[] Set Field [Date; $Start & "..." & $End] Perform Find[] Depending on what data type is in the variables, you may need to also play around with changing the data format: e.g. Set Field [Date; DateToText($Start) & "..." & DateToText($End)] Helpful Harry :o)