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

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

Recommended Posts

Posted

I'm looking for a script that will create a record for each Sunday in any given year, but I can't figure it out.

Posted

Start by calculating the date of the first Sunday in the given year. Then loop, creating a record for each Sunday and adding 7 days, until you reach the following year:

Set Variable [ $sunday; Value:Let (
   nY = Date ( 1 ; 1 ; Get (ScriptParameter ) ) 
   ;
   nY + Mod ( 1 - DayOfWeek ( nY ) ; 7 )
)]
Loop
   New Record/Request
   Set Field [ YourTable::Datefield; $sunday ]
   Set Variable [ $sunday; Value:$sunday + 7 ]
   Exit Loop If [ Year ( $sunday ) > Get ( ScriptParameter ) ]
End Loop
Commit Records/Requests

where the given year is passed as the script parameter.

This topic is 2052 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.