December 10, 200322 yr 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
December 10, 200322 yr Better change that to: SetField ("Date", "Status(CurrentDate)+7") just in case the file has been open since before midnight.
December 10, 200322 yr 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
December 10, 200322 yr 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,
December 10, 200322 yr 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)")
December 10, 200322 yr 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
December 10, 200322 yr 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
December 10, 200322 yr 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
December 10, 200322 yr I came in 2nd again. Oh well. At least he should get to the bottom of the problem.
December 10, 200322 yr 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?
December 10, 200322 yr 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
December 10, 200322 yr 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
December 10, 200322 yr 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.
December 19, 200322 yr 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