Jump to content

Script-driven Find Request featuring a date range


This topic is 7555 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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

Link to comment
Share on other sites

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)

)

--

Link to comment
Share on other sites

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)]

Link to comment
Share on other sites

This topic is 7555 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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