April 1, 200322 yr 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
April 1, 200322 yr 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.
April 2, 200322 yr "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.
April 2, 200322 yr Author 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
April 2, 200322 yr "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!
April 19, 200322 yr 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
April 19, 200322 yr 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 ?
April 19, 200322 yr Author 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
April 22, 200322 yr Yes Lee, Multi-key = MIDDLE(VALUELISTITEMS(STATUS(CURRENTFILENAME); "weeklist"); POSITION(VALUELISTITEMS(STATUS(CURRENTFILENAME); "weeklist"); "
Create an account or sign in to comment