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.

Script-driven Find Request featuring a date range

Featured Replies

Hello everyone. I'm trying to write a simple Find script that asks for two dates (start and finish), then automatically finds all records within that date range. I'm not sure what I'm doing wrong, but this seems like it should be simple???

I'm using the Custom Dialogue script step in FMP6 and having the dates stored temporarily in two global fields (date_from and date_to). I then attempted to have FM create a Find Request and insert:

date_from & "..." & date_to

...into my date field for the search. While FM doesn't complain about this script step, when run, it only inserts the first date. What am I doing wrong?

Thanks!

-Rob

Use DateToText( date_from ) & "..." & DateToText( date_to ) and be sure to use the Insert Calculated Result script step.

Just to guild the lilly a bit... i did this same feature yesterday, and you can trap for open-ended ranges too. this is the calculations used by the "Insert Calculated Result" step:

--

Case(

IsEmpty(gDateRangeStart) and IsEmpty(gDateRangeEnd),

TextToDate(""),

IsEmpty(gDateRangeStart),

"<=" & DateToText(gDateRangeEnd),

IsEmpty(gDateRangeEnd),

">=" & DateToText(gDateRangeStart),

DateToText(gDateRangeStart) & "..." & DateToText(gDateRangeEnd)

)

--

Hi Rob ...

Just to clarify Queue's reply:

1. You have to use the "Insert Calculated Result" script step. You can't use "Set Field".

2. The target date field must be on the current layout for the "Insert Calculated Result" script step to work.

Insert Calculated Result [your date field, TextToDate(gstartdate) & ".." & TextToDate(genddate)]

And to clarify Jim's reply: wink.gif

TextToDate is transposed. DateToText was the intent.

  • Author

Thanks everyone! Worked like a charm. :-)

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.