a311shark Posted December 10, 2003 Posted December 10, 2003 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
dbruggmann Posted December 10, 2003 Posted December 10, 2003 Use: SetField ("Date", "Today+7") ==> Date is your
BobWeaver Posted December 10, 2003 Posted December 10, 2003 Better change that to: SetField ("Date", "Status(CurrentDate)+7") just in case the file has been open since before midnight.
a311shark Posted December 10, 2003 Author Posted December 10, 2003 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
Lee Smith Posted December 10, 2003 Posted December 10, 2003 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,
BobWeaver Posted December 10, 2003 Posted December 10, 2003 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)")
a311shark Posted December 10, 2003 Author Posted December 10, 2003 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
dbruggmann Posted December 10, 2003 Posted December 10, 2003 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
kenneth2k1 Posted December 10, 2003 Posted December 10, 2003 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
kenneth2k1 Posted December 10, 2003 Posted December 10, 2003 I came in 2nd again. Oh well. At least he should get to the bottom of the problem.
a311shark Posted December 10, 2003 Author Posted December 10, 2003 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?
kenneth2k1 Posted December 10, 2003 Posted December 10, 2003 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
a311shark Posted December 10, 2003 Author Posted December 10, 2003 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
a311shark Posted December 10, 2003 Author Posted December 10, 2003 Sorry didn't se the second page right away. I am running 5.5
BobWeaver Posted December 10, 2003 Posted December 10, 2003 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.
-Queue- Posted December 10, 2003 Posted December 10, 2003 And the extra parens after 7 should give you a warning.
a311shark Posted December 11, 2003 Author Posted December 11, 2003 That solved it. Thanks for everyones help. a311shark
kenneth2k1 Posted December 11, 2003 Posted December 11, 2003 Oops. My bad. Did I screw that up? That's what I get for not proofreading.
-Queue- Posted December 19, 2003 Posted December 19, 2003 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.
Recommended Posts
This topic is 7649 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 accountSign in
Already have an account? Sign in here.
Sign In Now