Lee Smith Posted April 1, 2003 Posted April 1, 2003 Is there a script that can create a record for each date in the Week of Year. In orther words, today's date falls within the 14th week of the this year. I would like to be able to put a start date, such as 4/1/03, into a field, and then run a script that would create a record for each date 4-1-03 to 4-15-03 (inclusive), for each employee. Does this make sense? Is there a better way to approach this? TIA Lee
BobWeaver Posted April 1, 2003 Posted April 1, 2003 The date range you gave in your example is 2 weeks, and starts on Tuesday, so I'm not sure if that was a typo or intentional. But here is a sample script that will generate dates from Sunday to the following Saturday for the current date: Set Field [gStartDate, Status(CurrentDate)-DayOfWeek(Status(CurrentDate))] Set Field [gCounter,1] Loop Exit Loop If [gCounter>7] New Record/Request Set Field [Date, gStartDate+gCounter] Set Field [gCounter,gCounter+1] End Loop You can adjust the range by changing the 'Exit If' statement, and adjust the starting weekday by adding or subtracting an offset to the Date.
Vaughan Posted April 2, 2003 Posted April 2, 2003 "Is there a better way to approach this?" You've seen Smart Ranges? http://www.onegasoft.com/articles/smartranges/index.shtml I cannot claim to understand how it works, but I've used it several times. It might help you in this instance.
Lee Smith Posted April 2, 2003 Author Posted April 2, 2003 Hi Vaughan, I've seen it, I've studied it, and two years after downloading it, I still don't understand it. Thank you for your response though, I really do appreciate it. Lee
Vaughan Posted April 2, 2003 Posted April 2, 2003 "I've seen it, I've studied it, and two years after downloading it, I still don't understand it." Yeah, well, I just cut and paste the calculations between the sample file and mine and hope it works!
Ugo DI LUCA Posted April 19, 2003 Posted April 19, 2003 Hi Lee, Hi Vaughan, Well I've studied it also for the last 4 hours, and pasted all combinations, then modified them to the proper french definitions for my FM . But it still doesn't work. I've got a strange number result, not a Multikey. I wondered if you've solved this one as it is exactly what I'm looking for. Enter a Week N
Ugo DI LUCA Posted April 19, 2003 Posted April 19, 2003 OOps, I feel stupid ! 1. I've dowloaded it from fmfiles 2. My pastes were OK as long as my own method. It's just that carriage returns in Num fields.... 3. I even tried with the text field and it seems to work fine with both text and num results, don't know why ? Maybe a litte (non related to FM ) question, to feel again even more stupid. Are there always 53 weeks in a year ?
Lee Smith Posted April 19, 2003 Author Posted April 19, 2003 Hi Ugo, Are you saying the calculations in your post work for a relationship multikey out of the box? Maybe it's time to play around with it some more? Lee
Ugo DI LUCA Posted April 22, 2003 Posted April 22, 2003 Yes Lee, Multi-key = MIDDLE(VALUELISTITEMS(STATUS(CURRENTFILENAME); "weeklist"); POSITION(VALUELISTITEMS(STATUS(CURRENTFILENAME); "weeklist"); "
Recommended Posts
This topic is 8232 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