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.

Date + 7 days script

Featured Replies

I am trying to write a script to add 7 days to the current date by clicking a button and enter the new date in a specified field. all help is much appreciated.

Running FM 5.5 PC

Best Regards, a311shark

Use:

SetField ("Date", "Today+7") ==> Date is your

Better change that to:

SetField ("Date", "Status(CurrentDate)+7")

just in case the file has been open since before midnight.

  • Author

Thanks for your feedback.

Here's what I have done and I am getting a ? in the field

Setup the new script in script maker with the appropriate field name.

Updated the button to perform the script.

IS there any way to see where the script is breaking?

thanks a311shark

I was wondering you were going to be able to use the Set Field in a date field. Most of the time you need to use the Insert Calculated Results for date

The Date field needs to be on the current layout,

Insert Calculated Result [select,

I think a set field should be okay as long as it's not a date range. But, it may have to be converted to with the TextToDate function:

SetField ("Date", "TextToDate(Status(CurrentDate)+7)")

  • Author

Thanks for your help. Now I am getting Status(Call Date)+7 inserted in the space instead of the updated date?

I have a date field that I am getting the current date from

The field I am entering the data into is still formated as a date field?

We are getting closer but not quite there. Thanks

With the "Status(CurrentDate)" function or the "Today" function date you don't need another field and you can use the SetField script step.

I f you want to use the data from another field as "CurrentDate" (that's the way I understand your field

Hi:

"add 7 days to the current date by clicking a button and enter the new date in a specified field"

You don't need Insert Calculated result or DateToText if this is really a date field. What was told to you originally should work.

Set Field [DateField, "Status(CurrentDate) + 7)"]

Now, I am confused by your last post where you said that you were getting a date from a field "Call Date" or something like that. You should not need to get the current date from a date field, but if you want to set a date field to the value of one date field + 7, you would need something else. Please be more clear on what you are doing.

Ken

I came in 2nd again. Oh well. At least he should get to the bottom of the problem.

  • Author

Here's what I have setup:

The field I want the sum entered into is named Call Back (date formated)

Set Field [Call Back, "Status(CurrentDate) + 7)"]

I get a ? instead of the new date?

Am I missing a configuration somewhere?

I don't have CurrentDate listed in the drop down for status? Is this the problem?

Oh. Do you have an older version?

You may be stuck with the Today function because I think Status(CurrentDate) is not present in older versions.

Ken

  • Author

Here's where I am at

Set Field [DateField, "Status(CurrentDate) + 7)"]

This turns up a question mark.

I don't show Current Date under my status dropdown but I wrote it in:

Status(CurrentDate)

my DateField is Call Back which is formated as a date field which I am ussuming I want the resulting dat incerted in.

Set Field [Call Back, "Status(CurrentDate) + 7)"]

Thanks

  • Author

Sorry didn't se the second page right away.

I am running 5.5

I think the problem is the quotation marks. Take them out. The formula should be:

Status(CurrentDate)+7

not

"Status(CurrentDate)+7"

When the set field command is displayed in the script listing, it shows quotes around the formula, but you don't put them in when entering the formula.

And the extra parens after 7 should give you a warning.

  • Author

That solved it. Thanks for everyones help.

a311shark

Oops. My bad. Did I screw that up? That's what I get for not proofreading.

Just to add more to the melee, I've found that Today seems to work fine in scripts. One such as: If ["Date = Today"] Show Message ["Yes"] Else Show Message ["No"] works when merely changing the system date on a user's machine. So it would seem that Today == Status(CurrentDate) when scripting.

Create an account or sign in to comment

Important Information

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

Account

Navigation

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.