based on the current date...any ideas? For example, if it is Wednesday and I am trying to set a follow up call for the next instance of a Tuesday, how could I script that?
So your input is a date (today's in the above example) and a selected dayname (Tuesday in the above example)...
Let ( [ Dt = DateFieldHere ;
Dnumb1 = DayofWeek ( Dt ) ;
Dnumb2 = Ceiling ( Position ( "SunMonTueWedThuFriSat" ; Left (DayNameHere ; 3 ) ; 1 ; 1 ) / 3 )
If ( dnumb2 > Dnumb1 ; Dt + Dnumb2 - Dnumb1 ; Dt + 7 - Dnumb1 + Dnumb2 )
You'll need to insert your field or variables for the date and day of week in the places where you find "DateFieldHere" and "DayNameHere".
Add a variation (searching in 2 weeks "calendar")
Let ( [
d = Date(10;2;2017) ; //base date
dn = "Sat" ; //day name search for next
dns = "SunMonTueWedThuFriSatSunMonTueWedThuFriSat" ;
d1 = ( DayOfWeek ( d ) -1 ) * 3 + 1 ;
d2 = Position ( dns ; dn ; d1 + 1 ; 1 )
d + ( d2 - d1 ) / 3
I tried to use DayName() function, but this doesn't return English result on my Japanese OS.
Retrieving data ...