Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How do I find "current month"?

Featured Replies

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?


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.

  • Author

Thank you! I will try soon and get back.

  • Author

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.

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.

  • Author

It works! Thanks very much for your kind help and patience. It's much appreciated.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.