Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Specific Day of week within a date range 2

Status
Not open for further replies.

Indystock

Technical User
Aug 1, 2002
3
US
Hi All,
I'm hoping someone can steer me in the right direction on how to write a formula that will return all "Tuesdays" (for example) between two dates. I will need to write user parameter's to determine what day of week they want and what date range, but my main problem is not really knowing how to go about Extracting the same day of week's data out of several weeks range.
Also, if anyone knows of a good Crystal reports book that focuses predominantly on formula syntax and such, your recommendation is appreciated! :)
Many Thanks for any insights someone may be willing to give.
-Michael
 
To get Tuesdays, in your select expert use:
DayOfWeek({you.date.field}) = 3 Mike

 
Thanks Mike, that is helpful, but since I have a range of dates, as opposed to just a date field, I was hoping to get a little syntax help on how to return that day of week's data within the whole range. The user would select the day they need, such as "Tuesday", and I would pass the "3" to the formula to return all the Tuesday's within the range.
Thanks for taking the time to reply! :)
 
First, create a parameter field for date range. Then create another paramter field of data type number, for each day of week, with default values of 1 thru 7 and descriptions of Sunday, Monday, ....thru Saturday.

Then make a record selection formula as follows:

{DateField} in {?DateRangeParameter} and
Dateofweek({DateField}) = {?DayofWeek}

If you have any problems, let me know. Software Training and Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
Building off of dgillz's method to get the date range, for the day of the week you could do the following if you want the user to only have to pick a day of the week and not a number.

Create this formula:
@day_of_week
weekdayname(dayofweek({@date}))

For your parameter, establish the days of the week as the default values. (Make sure the spelling is correct)

Then in your select expert use:
{@day_of_week} = {?day of week parameter}
Mike

 
Thanks, you guys are awesome! I really appreciate the advice, it helped me out a lot... worked perfectly and saved me a lot of time.
Really Grateful here!
-Michael
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top