Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

Hi there, was hoping for a little help, as I am stumped. I am using FM 8.5 and I have a field that I use to show a date, usually, 1 year from the current date. Right now, I have FM auto fill the field with the current date, then change it manually to 1 year beyond. Is there a way to script a button to automatically insert the date + 1 year? Thanks

PS. we use 8.5 client and 9.0 server, any chance for corrupted data in my unique identifier? Thanks

Posted

Hi,

You should be able to use Set Date Field = Get(CurrentDate)+365; where 365 = days per year and Get(CurrentDate) returns the current date. Alternately you can have a global field defined as "years or days to add", and add that as part of the automatic calculation, so the button need not be pressed.

If you must also account for leap years, a CASE statement on the year can achieve that.

Posted

Date field is used to track follow up appointments at a medical office. I want to click on one of 3 buttons to set a follow up date for 1 yr, 6 months or 3 months. I'll try these 2 methods out, thanks so much!

Posted (edited)

Hi Stevireno,

LaRetta has given you a calculation that would work for the 1 year, you can also use Date Field + 365 to get the One Year from your date.

Attach your scripts to a button and use the Set Field script step to set your future follow up date.

Be sure your Calculation Results as a Date

3 months

Set Field(FutureDate; YourContactDate + 90

6 months

Set Field(FutureDate; YourContactDate + 180

1 year

Set Field(FutureDate; YourContactDate + 365

Set Field [FurtureContacDate; Date ( Month (ContactDate ) [color:blue]+3 ; Day (ContactDate ) ; Year

(ContactDate ) ) ]

Set Field [FurtureContacDate; Date ( Month (ContactDate ) [color:blue]+6 ; Day (ContactDate ) ; Year

(ContactDate ) ) ]

Set Field [FurtureContacDate; Date ( Month (ContactDate ) ; Day (ContactDate ) ; Year

(ContactDate ) [color:blue]+ 1 ) ]

or using LeRatta's calculation

3 months

Date ( Month ( Get ( CurrentDate ) [color:blue]+ 3 ) ; Day ( Get ( CurrentDate ) ) ; Year ( Get ( CurrentDate ) ) )

6 months

Date ( Month ( Get ( CurrentDate ) [color:blue]+ 6 ) ; Day ( Get ( CurrentDate ) ) ; Year ( Get ( CurrentDate ) ) )

1 year

Date ( Month ( Get ( CurrentDate ) ) ; Day ( Get ( CurrentDate ) ) ; Year ( Get ( CurrentDate ) ) [color:blue]+ 1 )

HTH

Lee

Edited by Guest
Posted

Just want to point out that LaRetta's solution is the strongest in the thread.

Get(CurrentDate) + 365 will only return the correct result 75% of the time.

And the +90 and +180 will work less than that.

Posted

First of all, I never said that one calculation is better than the other. In fact, if you had looked at the example file I posted for Stevireno, you would see that I gave examples of both calculations, three scripts, and three calculation fields, just so that Stevireno could see the difference. I don't think it really matters here which one is used.

Date field is used to track follow up appointments at a medical office

Because, every doctor's appointment I have ever made, has been a negation between me and the receptionist, as I'm leaving the exam room. In other words, I tell them when the doctor want's to see me, or in some cases the Doctor will tell them, and the whoever is scheduling the actual appointment will toss out times and dates within the time frame suggested by the doctor, and we settle on a time and date.

I can think of other needs here, but without addition information about the end result by Stevireno, it would be fruitless for us to be guessing.

Lee

Posted

Maybe this will clarify, we send out postcards annually(sometimes sooner) to remind people of their routine exams, we don't schedule them as they leave one routine exam for another a year out.

I just need the calculation to move the number of months up by X months, the actual date is not a concern, I just need the field to show any date within the 3rd, 6th, 12th, 24th month in the future from the current month. Sorry for my vague request, I am a little new at this!

Posted

If you are going to quote me, make sure you keep it in content. :

Because, every doctor's appointment I have ever made, has been a negation between me and the receptionist, as I'm leaving the exam room

Lee

Posted

You didn't do anything wrong.

You have a choice of calculations, either of which will do what you have described as your need.

Lee

Posted

You can tell them all you want that both calcs will produce the same results but that will NEVER make it so.

I never said that both calculations produce the same result.

In fact, if you had looked at the example file I posted for Stevireno, you would see that I gave examples of both calculations, three scripts, and three calculation fields, just so that [color:orange]Stevireno could see the difference

Lee

Posted

Thanks for your correction, the nested function you proposed is much more elegant than the +365 with CASE to handle leap years that I had proposed! It's interesting to read these forums as I'm always learning new things.

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