Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Script for creating dates per WeekofYear


This topic is 7839 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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 tongue.gif

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

smile.gif

Link to comment
Share on other sites

"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!

Link to comment
Share on other sites

  • 3 weeks later...

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

Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

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 confused.gif

Link to comment
Share on other sites

This topic is 7839 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.