Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted (edited)

Search/Find between 2 dates.

I have a field 'created' [Date], where the date is automatically entered when the record is created.

I have made 2 more fields 'gStartdate' and 'gEnddate' [both Date].

But my script below, does not produce the expected result (all records between the two dates entered)

Allow User Abort [Off]

Set Error Capture [On]

Show Custom Dialog ["Search between two Dates"; "Use the Format dd/mm/yyyy i.e. 25/09/2006"; Link::gStartDate; Link::gEndDate]

Enter Find Mode []

Set Field [Link::Created; Link::gStartDate & "..." & Link::gEndDate]

Perform Find/Replace [No dialog; Find Next]

Thanks in advance

John (very much a Novice)

Edited by Guest
Posted

It looks pretty much as it should, except last line where you have chosen to use this:

http://www.filemaker.com/help/Script-Steps36.html

...which doesn't make sence in your case, you should have picked this one instead:

http://www.filemaker.com/help/Script-Steps71.html

--sd

Posted

I have changed the script, but, no success.

Allow User Abort [Off]

Set Error Capture [On]

[color:blue]Show All Records

Show Custom Dialog ["Search between two Dates"; "Use the Format dd/mm/yyyy i.e. 25/09/2006"; Link::gStartDate; Link::gEndDate]

Enter Find Mode []

Set Field [Link::Created; Link::gStartDate & "..." & Link::gEndDate]

[color:blue]Perform Find [Restore]

It does not seem to make any difference what I enter for the query dates, i.e. 01/012006...01/06/2006

I still get the same results, i.e.

"Found 1013"

whish includes the following...

01/09/1990

01/09/1990

01/09/1990

12/09/2005

12/09/2005

12/09/2005

John

Posted

Remove the Restore inside the [ ] in last line. Because you Show All Records count as a restoreable request. It has no meaning in you script to use Show All Records, the command is only required if you need to be sure all records is selected before say a looping script.

--sd

Posted

AARRRRRGGGHHH!

Soren

When I double checked, I found that I had not set the 2 Fields as Globals, even though I would have bet money that I had.

All working now. Thanks for your help and my apologies for wasting your time.

John (definitely a novice)

Posted

I found that I had not set the 2 Fields as Globals

It can be done recursively though, it's a shame the dialog requires real fields!

If [ IsEmpty ( Get ( ScriptParameter ) ) ] 

     Show Custom Dialog [ Message: "Search between two Dates"; "Use the Format dd/mm/yyyy i.e. 25/09/2006"; Buttons: “OK”;  Input #1: theDateSearch::theLower, "Start Date"; Input #2: theDateSearch::theUpper, "End Date" ] 

     Perform Script [ “DateRangeSearch”; Parameter: theDateSearch::theLower & "..." & theDateSearch::theUpper ] 

Else 

     Set Field [ theDateSearch::theLower; "" ] 

     Set Field [ theDateSearch::theUpper; "" ] 

    Enter Find Mode [  ] 

    Set Error Capture [ On ] 

    Set Field [ theDateSearch::StoredDate; Get ( ScriptParameter ) ] 

    Perform Find [  ] 

    Set Error Capture [ Off ] 

End If 

--sd

This topic is 6692 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.