PacificStar Posted September 5, 2009 Posted September 5, 2009 I wrote a script in FM9 that generates a report, narrowing information by user specified date range. Enter Find Mode Go to Field (orderdate) Set Field (orderdate) to DateRange Set Error Capture On Perform Find. Worked great in FM9, doesn't work in FM10. Seems to be a problem with setting the field to the DateRange, which is a calculated field based on a start date and an end date. The calculation results in a field value that is something like 1/1/2008...1/31/2008. Works if I manually enter it in while in Find mode, but FM10 seems to dislike that format when trying to enter it in to a date field. Any ideas on how to get around this? Thank you in advance for any information you may be able to provide.
bcooney Posted September 5, 2009 Posted September 5, 2009 How is the user specifying the date range? Are they entering Start Date and End Date into global fields? Why not just take them to Find Mode and Pause? Do you know that you can Find for all January 2008 records by entering 1/*/1998 in Find mode? You do not need to Go to Field before using Set Field, btw.
comment Posted September 5, 2009 Posted September 5, 2009 Do you know that you can Find for all January 2008 records by entering 1/*/1998 in Find mode? No, I don't.
bcooney Posted September 5, 2009 Posted September 5, 2009 Duh, for 2008, you'd enter 2008. Comment, please, I'm old and haven't adjusted yet to the century change, lol.
comment Posted September 6, 2009 Posted September 6, 2009 That wasn't my main point. http://www.youtube.com/watch?v=QLILrC7Y5L4&feature=fvst
PacificStar Posted September 6, 2009 Author Posted September 6, 2009 Date range is specified by entering a start and end date in to global fields. I usually do not need just one month, but rather a range of months, depending on the report that is being run. I don't see any purpose in pausing the script, if I can have it do everything it used to do under FM9. And for a user it's easier for them to enter start and end dates, rather than enter find mode, enter a formatted date range, find the results, and then run a script to format the report.
comment Posted September 6, 2009 Posted September 6, 2009 I am not aware of anything new in version 10 that should affect your script. However, you did not tell us anything about how DateRange is calculated, and the description of the problem is rather vague. I suggest you put a pause in the script right before Perform Find, and examine the actual criteria in the orderdate field.
bcooney Posted September 6, 2009 Posted September 6, 2009 If all you need is to Find on a date range, then you're right, why put the user in a Find layout, paused, with a button that Resumes and continues on to the report. But, as Comment says, it's not apparent how you calc DateRange. You need to examine what you have in the OrderDate field when you are in Find. A debug Pause or Modify Last Find will offer a clue.
PacificStar Posted September 6, 2009 Author Posted September 6, 2009 DateRange is a calculation. = DateStart & "..." & DateEnd. Unstored text--the calculation doesn't work if it's set to result in a date. For testing, I paused the script, entered a date range "1/1/2009...6/30/2009" and it worked. But if I don't pause the script, there is no value set in the OrderDate field.
PacificStar Posted September 6, 2009 Author Posted September 6, 2009 Problem solved. Thanks for pointing me in the right direction. Setting the OrderDate field to the value the calculation in the set field step, instead of setting it to a global field that is based on the calculation, allows the script to function correctly. Thank you very much!
bcooney Posted September 7, 2009 Posted September 7, 2009 "a global field that is based on the calculation," wonder what you mean by this.... All you need is two globals: gStartDate and gEndDate. Then a script: Enter Find Mode Set Field OrderDate, gStartDate & ".." & gEndDate Perform Find You never needed DateRange.
Recommended Posts
This topic is 5557 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