Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Script for date range find

Featured Replies

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

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

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.

  • 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?

The date field must be on the current layout when the script occurs.

  • 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

Are you using the Status(CurrentDate) function explicitly as stated? You must include DateToText( ) as well, or it will fail.

  • Author

Yes, I just double checked it.

Can you attach a clone of the file? This makes no sense to me. I'd like to see it for myself.

  • Author

Attached here. Thanks for your help. The scipt is "Find Date Range"

Dezza confused.gif

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)&"

There is no attachment. You'll need to zip or stuffit first, btw.

  • Author

Sorry about that. Here you go:

Yep. Sure enough looks like you did not uncheck "Restore find requests" in the Perform Find step.

Remove the 'Restore find requests' check on Perform Find as Vaughan instructed earlier.

  • Author

Thank you very very much.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.