Search code examples
c#crystal-reports

crystal report formula for ordering the Days of week


I want to make the crystal report formula to show the "Week days" in its correct order e.g. Monday, Tuesday etc. Please if any one knows it, suggest me. I will be very thankful. Thanks in advance enter image description here


Solution

  • You can use WeekdayName(DayOfWeek()). You just need to pass it the report date field.

    For example like this:

    WeekdayName(DayOfWeek({MyTable.MyDateColumn}))
    

    If you just need a calculated field for sorting the result, you might just use

    DayOfWeek({MyTable.MyDateColumn})
    

    If you consider Monday the first day of week you can use the second, optional parameter

    DayOfWeek({MyTable.MyDateColumn}, crMonday)