I need to figure out how many Fridays fall in a certain date range.
I had a good algorithm for it, but I dont know how to go about making a for loop.
Here's what I had
if {?postDate} = "" then
for i=0 to ((CurrentDate-{?preDate}) mod 7)
if DayOfWeek (DateAdd ("d",i,{?preDate})) = "Friday" then
truncate((CurrentDate-{?preDate})/7,0) + 1
next
truncate((CurrentDate-{?preDate})/7,0)
else
for i=0 to (({?postDate}-{?preDate}) mod 7)
if DayOfWeek (DateAdd ("d",i,{?preDate})) = "Friday" then
truncate(({?postDate}-{?preDate})/7,0) + 1
next
truncate(({?postDate}-{?preDate})/7,0)
So the question is, is there to run a for loop (which I'm guessing there's gotta be) and how do I do it.
TIA
I had a good algorithm for it, but I dont know how to go about making a for loop.
Here's what I had
if {?postDate} = "" then
for i=0 to ((CurrentDate-{?preDate}) mod 7)
if DayOfWeek (DateAdd ("d",i,{?preDate})) = "Friday" then
truncate((CurrentDate-{?preDate})/7,0) + 1
next
truncate((CurrentDate-{?preDate})/7,0)
else
for i=0 to (({?postDate}-{?preDate}) mod 7)
if DayOfWeek (DateAdd ("d",i,{?preDate})) = "Friday" then
truncate(({?postDate}-{?preDate})/7,0) + 1
next
truncate(({?postDate}-{?preDate})/7,0)
So the question is, is there to run a for loop (which I'm guessing there's gotta be) and how do I do it.
TIA