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

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

Recommended Posts

Posted (edited)

as a script step, i would like to find records in my database which range 2 days less than through two days greater than todays date

i can get records where x field has todays date by

perfrom find = data::x =//

but cannot figure out the script formula for a range of days off of the current date...such as

data::x =<2...//...>2

it must be simple, but i am stumped.

thanks for any help you can give

arfus nyc

Edited by Guest
Posted

Enter Find Mode [  ] 

Set Field [ Untitled::aDate; Get ( CurrentDate )-2 & "..." & Get ( CurrentDate )+2 ] 

Perform Find [  ] 

--sd

Posted

thank you for your help.

in that you all are in a concensus, clearly i am missing something here.

i am creating the script with scriptmaker and do not understand the script step:

Set Field [untitled::aDate; Get (Current Date) -2 & "..." Get (Current Date) + 2]

The field that i am performing the search in (for example) is "departure info" which is already a calculated value with a date return from fieldname "departure date"

Beyond my confusion of how the set field fucntion works, I think that 'current date' may be confusing.

I am requesting records where the date in 'departure info' field equals from plus to minus 2 days from todays date.

does that make sense?

me confused much?

Posted

... Ok, Get(CurrentDate) is a filemaker function that gets the current date... i.e todays date, therefore Get(CurrentDate) today would evaluate to 22/02/06 ... Get(CurrentDate) - 2 would evaluate to 22/02/06 - 2 days = 20/02/06

Therefore the total equation: Get(CurrentDate) - 2 & "..." Get(CurrentDate) + 2 would today evaluate to:

20/02/06...24/02/06

Now, thats the data that gets entered into the field..

The set field script step, simply sets any field you specify within the current table (or a table related to the current table) to whatever you specify in your calculation... which in this case would be the calculation Get(CurrentDate)-2 & "..." Get(CurrentDate) + 2

Finally, the filemaker find ... engine... can do range searches. A range search is delimited by 3 periods in between your lower value and your higher value, and filemaker will return to you all records that fit into your criteria... so in a normal find situation if you just entered 20/02/2006...24/02/2006 into a date field, all records that have a date between or including those two dates, would be returned to you...

Finally, summing up all the script does is enters find mode, sets the field Untitled::aDate = the result of the calculation Get(CurrentDate) - 2 & "..." & Get(CurrentDate) + 2 and then performs a find, thereby returning to you your original request of all records between those two specific dates...

as always, i hope this helped and lessened your confusion

~genx

Posted

Instead of specifying the field Untitled::aDate in your database, especially seeing as it in most likely hood doesnt exist, just specify your field, "departure info" or "departure date" or whatever the field you want to search in happens to be...

Remember, you are doing all of this in script maker, and then executing a script to find your records, you are not using a calculation field (though you could).. anyway, yeh... good luck

~genx

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