Skip 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.

Calculation in Months instead of years

Featured Replies

Case(IsEmpty(Date Inspected) or IsEmpty(Frequency); GetAsDate(""); Date(Month( Date Inspected); Day(Date Inspected);Year(Date Inspected)+Frequency))

I am using version 8

I have not used fmp for a while am a little rusty.

The above code calculates a date from the date Inspected and add's the number of years to it and places the result into the field called Due date.

However when i set it up i set the Frequency to be years instead of months, but i cannot seem to get the result to revert to add in months instead of years.

So if the user puts today's date as the Inspection date, and 3 in the Frequency, the result should be 31/6/09, but i get 15/3/2012.

How can i change it to months instead?

Corey....

I think your example dates have a typo or two in them.

Date (Month (InspectionDate); Day (InspectionDate); Year(InspectionDate)+Frequency)

Lee

  • Author

The example

dates the result should be 31/6/09, but i get 15/3/2012
should be 30/6/09. The 15/3/2012 is correct, as it was adding 3 years to today's date instead of months.

I managed to get a rough & ready result by using this

Case(IsEmpty(Date Inspected) or IsEmpty(Frequency); GetAsDate(""); Date(Month( Date Inspected); Day(Date Inspected);Year(Date Inspected)))+(Frequency*30.44)

I am after an exact calculation for months instead of my crude (*30.44) bit to divide the Frequency years into months.

Lee, that code you posted is the same as the code i posted ?

Corey....

Try adding the frequency to the month element of the date, instead of the year.

  • Author

Thanks Lee.

Easy as that, yet it was beyond me.

Cheers

Corey....

You're welcome, Sherman.

You mean comment, he beat me to the punch again. LOL

Lee

  • Author

You mean comment, he beat me to the punch again. LOL

Lee

Ahh yes i did.

Opps.

Quick question: can a Script be run from a Calculation, or only a Calculation run from Script ?

ie. If field [Due date] <= Today, then run a script to send an email.

Corey....

You can use a check with an opening script. Find those with Due date <= Today and then loop through.

BTW, if you upgrade to FM10, you can use SMTP email directly from FM without using an email client. You can also use script triggers to auto send the email when a user changes the date in the field or when going to a record, etc.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.