Skip 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.

scripting a date range

Featured Replies

Given a field with a start date and a field with an end date, is it possible to script a date range for a find ex: 1/2/02...2/15/02?

Enter Find Mode

Insert Calculated Result (into the date field) startdate &"..."& enddate

Perform Find

If StatusCurrentFoundCount=0

--do something to address null set

EndIF

HTH

Old Advance Man

  • Author

thanks for your response.

I tried that already but always get an empty result when there should be a result. When pausing the script to see what's happening, the date field entries go in as an FMP date format and does not retain the 1/2/2002 format Does that make a difference?

  • Author

I take that back...

I get an error message that says the inserted calculation must be in 2/3/2002 format. Instead, this is the entry format: 730866...730896

Where is the information coming from? The number you are seeing are how FileMaker stores dates internally. Dates are simply the number of days since 1/1/0001. It sounds like the date is getting converted to a number somewhere along the line.

Without knowing how you're getting the information that you're building the search on it's difficult to offer a suggestion. Perhaps you're having the user fill in some global date fields and then using a script to build the date range string. If this is the case, try changing the global date fields to global text fields. You'll need to do some error checking to make sure the dates are valid.

If this isn't the case, then try the following:

Insert Calculated Result [ DateToText( Date1 ) & "..." & DateToText( Date2 ) ]

Chuck

  • Author

Yes Chuck, you're right, it was data entered into a global date field. I' try setting them as text and converting from text to date.

Thanks

You will have to convert the dates to text.

Insert Calculated Results

DateToText(date 2) & "..." & DateToText(date3)

  • Author

I made that change to a global text field and used

Insert Calculated Result [Texttodate(date1)&"..."&Texttodate(Date2)

and get:

730866...730896

  • Author

I reverted the global text to global date fields, and used:

Insert Calculated Result [ DateToText(Date1)&"..."& DateToText(Date2)

and it worked great!

Thanks a lot. You guys are the best resource for FMP.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.