Maybe this is simple, but I just can't get it. I am using Report designer in VB. I have a group called salesman (sorted by salesman), and a field called DayofWeek. I want to sort the days of the week so Monday is first. Any Help? Thanks.
Mike Sayler
If you are using the dayofweek function, do the following:
dayofweek({table.date},2)
This makes Monday the first day of the week, and the formula will return a 1 for Monday, 2 for Tuesday, etc.
You can group on this to get the correct order, but then delete the group name from the group header and use the following for display:
weekdayname(dayofweek({table.date},2),false,2) //where the false indicates no abbreviation of the weekdayname, and the 2 again designates the beginning day of the week, in this case Monday.
I should have been more descriptive. The database field "DayOfWeek" is in the Details section. So what happens is that a particular salesman will have x amount of leads per week day. The report, when run lists in the detail section the salesmans name, dayofweek and num of leads. The dayofweek seems to come up in no particular order. ex. Friday, Monday, Thursday ... What I would like to have happen is Monday first and so on. Thanks.
MS
Create my formula for dayofweek and then go to report->sort records and insert the formula to achieve the order you want. Or you can group on the dayofweek formula and suppress the group header and footer.
The days are coming up in ALPHABETICAL order, because they are words not dates. If you have a true date field, sort on that. If not write a formula like the following:
if {field} = "Monday" then 1 else
if {field} = "Tuesday" then 2 else
if {field} = "Wednesday" then 3 else ....
And then sort on this formula. You don't have to see this formula to sort on it.
Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Tips and Tricks / Guide to Crystal in VB
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.