Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Graph - How to show data which doesn't exist Post Reply Post New Topic
Author Message
tmpopsl*g
Newbie
Newbie


Joined: 12 Jun 2009
Online Status: Offline
Posts: 5
Quote tmpopsl*g Replybullet Topic: Graph - How to show data which doesn't exist
     Posted: 12 Jun 2009 at 12:12pm
Hi,
 
Im trying to make some graphs of the count of incidents in our database.
It is being sorted per month, e.g. 10 incidents march 7 incidents april etc.
However when there are no incidents (0 incidents may), i would like crystal to show 0 instead of leaving the whole month out of the graph.
 
I found a few people with the same problem, but i couldnt find any solutions.
 
Maybe anybody can tell me if this is possible:
At runtime i give in 2 parameters, FromDate and ToDate.
Aint there any way to show every month between these parameters in the graphs 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Jun 2009 at 12:42pm
You need a data source that has every month in it, left join to that source and group from it.
IP IP Logged
tmpopsl*g
Newbie
Newbie


Joined: 12 Jun 2009
Online Status: Offline
Posts: 5
Quote tmpopsl*g Replybullet Posted: 12 Jun 2009 at 12:49pm
A table with just the months or months + years?
Because the graph shows data from more than one year.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Jun 2009 at 12:53pm

depends on how you are grouping. If you are seperating out by Month and Year then you will need both for the full possible range of dates that a user could opt to put in for the report range.

IP IP Logged
tmpopsl*g
Newbie
Newbie


Joined: 12 Jun 2009
Online Status: Offline
Posts: 5
Quote tmpopsl*g Replybullet Posted: 12 Jun 2009 at 1:08pm
I let the chart group itself, with the built-in per month grouping.
Like:
08 - 2008
09 - 2008
~
05 - 2009
06 - 2009
etc.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Jun 2009 at 1:32pm
If that is your preferred end result then you would want the year and month and then you need a way to join that field to the date field in your main report data.
IP IP Logged
tmpopsl*g
Newbie
Newbie


Joined: 12 Jun 2009
Online Status: Offline
Posts: 5
Quote tmpopsl*g Replybullet Posted: 13 Jun 2009 at 1:27am

Hm i made a mistake, the report uses grouping on companyname.

Every company gets his own chart. Thus when i try to left join the "months" table it wont work because just 1 company will get all the months right?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Jun 2009 at 5:43pm
Actually I believe those records would have a NULL for the companyname and would be grouped on the NULL.
You could create a sub-report linked on the company name and use your new month-year table in the sub report or change the table to include a yaer-month and companyname per company.
Perhaps you could create a stored procedure that would do the smae thing but I am not sure how.
IP IP Logged
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