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

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

Recommended Posts

  • Newbies
Posted

Hello. Beginner Here! :) I'm hoping someone here can help me with creating a simple script to perform a date range search. I'm using FMPro8 on Windows XP.

The script I'm trying to learn how to do would start by clicking a button, moving to a new layout that has a date field formatted with the calendar popup, which would be the beginning search date, then move to another calendar to provide the end date. Then execute the search range.

Thanks in advance for the help.

Posted

Do a search of the forum using your keywords, and you will find many, many threads on this subject.

Use [color:blue]+"Date Range" +Script (be sure to include the plus signs and quotes as I have) and this will return the maximum number of hits.

HTH

Lee

  • Newbies
Posted

Ok, I have read every single posting that I could find using the search +"Date Range" +Script and nothing has helped.

Is there not a simple way to do this? Something like:

Enter Find Mode

Go to Layout

Enter Find Mode [Pause]

Go to Field [sCHEDULED CLOSING DATE]

. . . . then something about using the calender to select the start date and then another calendar to select the end date . . . then continue with find, print, etc.?

Posted

You could just use

Go To Layout[Your Find Layout]

Go To Field[WhateverField]

If[isValid(WhateverField) and not IsEmpty(WhateverField)]

Go To Field[secondField]

If[isValid(SecondField) and not IsEmpty(SecondField]]

Freeze Window

Enter Find Mode[]

SetField[YourDateSearchField ; WhateverField & "..." & SecondField]

Perform Find[]

If[Get(lasterror) = 401]

Show Custom Dialog ["error" ; "no records found in this date range" ; "ok"]

Go To Layout[original layout]

End If

Else

Show Custom Dialog ["error" ; "you did not specify a valid end date" ; "ok"]

Go To Layout[original Layout]

End If

Else

Show Custom Dialog ["error" ; "you did not specify a valid start date" ; "ok"]

Go To Layout[original Layout]

End If

Posted

You should probably use better names than whateverfield and second field though... i.e. startDate and endDate. Set field 1 and 2 to be drop down calanders by double clicking on them and choosing the appropriate type.

Posted

The whatever fields need to be global fields.

The Go to Field steps are not required.

It would also be nice to give the user a chance to actually fill some dates:

Go To Layout [ where the two global fields are ]

Pause script [indefinitely]

#

Enter Find Mode[]

SetField [ Datefield ; gStartDate & ".." & gEndDate ]

Perform Find[]

#

If [ Get(FoundCount)]

Go To Layout [ layout to display the results ]

Else

# do something else

End If

Posted (edited)

Lol, i knew i forgot something... i usually just use a dialog for this anyway. .. I was for some unknown reason assuming that the script would pause until the user input something... oh well.

Edited by Guest
  • Newbies
Posted

I'm still totally lost here:(

1. how can i use a "Global" field. In the options when I look at "Global Storage" it says "A field taht uses global storage contains only one value that is shared across all records." this doesn't appear correct for what i'm doing as i don't want all records to have the same date. they each are unique otherwise i would have no need for a date range.

2. how can i have two fields with different names? i only have 1 field called "Scheduled Closing Date" that i want to search. I don't want to have to create 2 fields and have double entry. am i just stupid here?

3. i keep seeing people use a character in scripts i can't seem to find out how to type it though. it looks similar to ; but the bottom part is not a comma, but is straight up and down.

i can't believe how difficult this is. i could easily create this script with manual intervention and not using the calendar's but since i'm relying on office staff to run these reports i want to eliminate the human error factor of them possibly choosing the wrong date (via mis typing) or the wrong character (for equal to/greater than, etc.)

i appreciate everyone's help, but obviously there is no simple answer. i will keep trying with everyones assistance. what can i provide to make this easier?

Thanks,

Alden

Posted

i don't want all records to have the same date

Well, yes you do - you want all records to have the same start and end dates as the search criteria. There's no doubling here: each record has its own date (your Scheduled Closing Date). The two GLOBAL fields do not belong to any specific record (hence "global").

Posted

Basically the globals store only the find criteria full stop. They are used simply for temporary storage of data i.e. the user inputs the start date into one global field, the end date into another, and then your script adds together the two values, enter's find mode and specifies the criteria for your real date field to be: startDate & "..." & endDate.

Comeing back to date's, i'm not sure if this warrants it's own topic, but is there anyway to change the default american filemaker date (i.e. actually changing the file settings rather than using system settings)..

Cheers,

~Genx

Posted

is there anyway to change the default american filemaker date

The default is not U.S.- it's the system settings at the time the file was created. If you clone a file, the clone will inherit the current OS settings.

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