john9210 Posted April 13, 2019 Posted April 13, 2019 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.
comment Posted April 13, 2019 Posted April 13, 2019 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now