February 18, 200421 yr I'm creating a tickler database of tasks, and I'm having trouble writing a script that will perform a date range find. Basically, I want to push a button in my Contacts db that will then open the tickler database and show me the tasks that are due within the next seven days. I can't figure out how to script the find for the current date, plus seven days? Make sense? Sorry if this is cake. Dezza
February 18, 200421 yr Enter Find Mode [ ] Insert Calculated Result [datefield, DateToText(Status(CurrentDate)) & "..." & DateToText(Status(CurrentDate) + 7)] Perform Find [ ] If [not Status(CurrentFoundCount)] Enter Find Mode [ ] Show Message ["No tasks are due within the next week."] Show All Records End If
February 18, 200421 yr Do you want to find all tasks that have a due date within the next seven days, or only those tasks that are due but not yet completed? If the latter you'll need a "Completed" field as well as a "DueDate" field. For the script below, the Completed field is empty if it's not completed. Enter Find Mode [] Insert Calculated Result [DueDate, DateToText (Status(CurrentDate)) & "..." & DateToText (Status(CurrentDate) + 7)] Set Field [Completed, "="] Perform Find [replace current found set] Notes: the DueDate field must be on the current layout when the script is run. Also, the option "restore find requests" must not be selected for either the Enter Find Mode or Perform Find steps.
February 18, 200421 yr Author Thanks for the responses, but I must be doing something wrong. I enterd the script, as you've written, but FileMaker tells me there are no valid criteria in the request. What could I be messing up?
February 18, 200421 yr Author It is. I have only three layouts, and the the date field is on each one. I began the script by going to a new layout (which the date field was on), but when it didnt work, I deleted the layout and went back to the main page. Same problem. Dezza
February 18, 200421 yr Are you using the Status(CurrentDate) function explicitly as stated? You must include DateToText( ) as well, or it will fail.
February 19, 200421 yr Can you attach a clone of the file? This makes no sense to me. I'd like to see it for myself.
February 19, 200421 yr Author Attached here. Thanks for your help. The scipt is "Find Date Range" Dezza
February 19, 200421 yr While you investigate with Queue about this classic Find approach, here's another using relationships. g_DateRange c_ShowDateDue = Case(IsEmpty(Completed), Date, "") Then the script. SetField[g_DateRange, DateToText(Status(CurrentDate)+1)&"
February 19, 200421 yr Yep. Sure enough looks like you did not uncheck "Restore find requests" in the Perform Find step.
February 19, 200421 yr Remove the 'Restore find requests' check on Perform Find as Vaughan instructed earlier.
Create an account or sign in to comment