Jump to content

Email script - checking for a date

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

Recommended Posts

  • Newbies

Hi all,

I need a smidge of advice.

I am hoping to add a script to my client database.

Here is what I would like to happen.

I open fm, the script runs. The script performs a find looking for all records in the 'reviewdate' field that either = todays date or are anywhere between todays date and seven days into the future. When it has located these records I want the script to copy the data in the 'review notes' field into an email for each record found.

I have so far worked out how to do the find and how to paste the data found into an email for each record. However the trouble I am having is getting it to only select dates within that 7 day period and if the dates don't fall in that seven day period I don’t want it to do anything. I guess it would also be a good function for it to ignore any records that have previously been emailed.

As you can probably tell FM is new to me. I am doing ok but this seems intricate.



Link to comment
Share on other sites

You want to do a range search

So just use:

Freeze Window

Allow user abort[Off]

Set Error Capture[On]

Set Field[ yourdatefield ; Get(CurrentDate) & "..." & Get(CurrentDate) + 7 ]

Perform Find[]

If[ Get(LastError) <> 0 ;

..Show Custom Dialog[ No Records Found ; No Records Found ; Ok, Cancel ]

#Do Whatever you want here

Exit Script[]

End If

#Rest of your script here

Now keep in mind, that some of the functions may not be called the same thing in FM 5 (can't help you there) but the concept should be the same.

Link to comment
Share on other sites

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