February 17, 200917 yr 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
February 17, 200917 yr 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 ) )
February 17, 200917 yr 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
February 17, 200917 yr Author 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!
February 17, 200917 yr 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.
February 17, 200917 yr I wouldn't use DayName() for this, because it will break if the language is not English: Fair call.
April 2, 200916 yr Author 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.
Create an account or sign in to comment