Nishimark Posted April 22, 2007 Posted April 22, 2007 Greetings. I would like to create a script that, among other things, displays all records for the current month, as well as another script that can display all records for the previous month and one for next month. I would like FM to determine the current month so that I don't have to manually enter it. I have a single date field that shows the date of an event. I would like to be able to make buttons for "This Month", "Last Month", and "Next Month" that will operate scripts to do those searches. Any ideas?
Genx Posted April 22, 2007 Posted April 22, 2007 Enter Find Mode[] Set Field[ date ; Let( monthOffset = 0 ; Date ( Month(Get(CurrentDate)) + monthOffset; 1 ; Year(Get(CurrentDate)) ) & "..." & Date( Month(Get(CurrentDate)) + 1 + monthOffset ; 0 ; Year(Get(CurrentDate))) ) ] Perform Find[] Change MonthOffset accordingly... -1 will give you previous month + 1 will give you next month +2 the month after that, 0 will give the current month... You may want to pass the value as a script parameter instead of hard coding it though.
Nishimark Posted April 22, 2007 Author Posted April 22, 2007 Thank you! I will try soon and get back.
Nishimark Posted April 22, 2007 Author Posted April 22, 2007 Sorry, but could you walk me through it a bit slower. Where and how do I enter the script that you noted in your previous e-mail? thanks.
Genx Posted April 22, 2007 Posted April 22, 2007 Hi Nishimark, Go To Scripts -> ScriptMaker Add a new script, call it "month_search" Add the following steps from the left bar: Enter Find Mode Set Field Perform Find For the Enter Find Mode, uncheck "pause" For Set Field, specify your target field to be whatever date field it is you are searching for For the calculation specify the following: Let( monthOffset = Get(ScriptParameter) ; Date ( Month(Get(CurrentDate)) + monthOffset; 1 ; Year(Get(CurrentDate)) ) & "..." & Date( Month(Get(CurrentDate)) + 1 + monthOffset ; 0 ; Year(Get(CurrentDate))) ) Click Ok to save the script and Ok to exit ScriptMaker. Now, enter layout mode, draw a shape or insert an image for your button. Right click the image / shape and choose button Setup. Choose perform script from the bar in the left and then click the specify button. Find the script you called "month_search" and down the bottom where it says "optional script parameter" enter the month offset i.e. -1 for the previous month, 1 for the next month, 0 for the current month etc. Click OK and then try run the script.
Nishimark Posted April 23, 2007 Author Posted April 23, 2007 It works! Thanks very much for your kind help and patience. It's much appreciated.
Recommended Posts
This topic is 6481 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 accountSign in
Already have an account? Sign in here.
Sign In Now