March 30, 200916 yr 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....
March 31, 200916 yr I think your example dates have a typo or two in them. Date (Month (InspectionDate); Day (InspectionDate); Year(InspectionDate)+Frequency) Lee
March 31, 200916 yr 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....
March 31, 200916 yr 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....
March 31, 200916 yr 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