dulux Posted February 17, 2009 Posted February 17, 2009 Hi all, Just a newb question here - I need to take a date and calculate 10 weeks on from it automatically. If the day turns out to be a weekend it should automatically round off to the next Monday. Any ideas how I need to do this? Some of the solutions on here are a little intricate for what I need for this! Thanks in advance for your kind assistance. Rgds
Genx Posted February 17, 2009 Posted February 17, 2009 Assuming 7 days a week which we will because you haven't stated there aren't, something like the following should work: Get(CurrentDate) + 70 + Case( DayName(Get(CurrentDate)) = "Saturday" ; 2 ; DayName(Get(CurrentDate)) = "Sunday" ; 1 ) ... or if you want to use something other than the current date use the below and replace get(currentDate) with your date field / value: Let( x = Get(CurrentDate) ; x + 70 + Case( DayName(x) = "Saturday" ; 2 ; DayName(x) = "Sunday" ; 1 ) )
comment Posted February 17, 2009 Posted February 17, 2009 I wouldn't use DayName() for this, because it will break if the language is not English: YourDate + Position ( "17" ; DayOfWeek ( YourDate ) ; 1 ; 1 ) + 70
dulux Posted February 17, 2009 Author Posted February 17, 2009 That is fabulous! Thanks for the assists there. Interesting point about the language, but as luck would have it I am using English in this db. Many thanks!
comment Posted February 17, 2009 Posted February 17, 2009 as luck would have it I am using English in this db. It's a matter of good practice. Hopefully, one day your solution will be a world-wide success - and THEN you'll wonder why it doesn't work for some.
Genx Posted February 17, 2009 Posted February 17, 2009 I wouldn't use DayName() for this, because it will break if the language is not English: Fair call.
dulux Posted April 2, 2009 Author Posted April 2, 2009 Hi there I have finally got around to giving this a go and it just isn't working for me. I get a load of errors stating that either the GET function will not work or else there are missing parameters. I followed the instructions so am a bit baffled. I would like this to be a script rather than a calculation as I want more control over when it is calculated. Thanks for your help.
Recommended Posts
This topic is 5773 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