Report Design
 Crystal Reports Forum : Crystal Reports .NET 2003 : Report Design
Message Icon Topic: week grouping Post Reply Post New Topic
Author Message
Gian Luca
Newbie
Newbie
Avatar

Joined: 20 Oct 2010
Location: Italy
Online Status: Offline
Posts: 6
Quote Gian Luca Replybullet Topic: week grouping
    Posted: 20 Oct 2010 at 5:11am
Hi all,
Pretty new at CR. I need to group all payables by due week. All i have - per each record - is the due date (per day, not per week)

For instance I need a report like this:

                 year 2010                                         year 2011
                 week1       week2     week3   etc etc    week 1      week 2   etc   etc
supplier 1    $ 100       $56        $ 99                       $0          $1         $0
supplier 2    $   0        $ 876      etc   etc

I saw CR has  Year/Month/day functions but not weeks. How can I do that?

Thanks a lot.
Cya.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 21 Oct 2010 at 3:36am
if you can use stored procs, I would say add a column to the result set for the year/week number and use the DATEDIFF() to calculate the nubmer of days from a given start date (which if is calendar years, could be 1/1/YEAR(payableDate)).
 
Now that you have the number of days, for simplicity, add the 7 - (dayCount mod 7) so that all the days are in increments of 7, then divide them all by 7 to get the week number.
 
You might be able to do this in CR, but it would be difficult as you need to alter a column (or change the data in it so that it works for you)...stored procs are always the easiest.
 
HTH
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.