Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Line graphs in crystal 10 Post Reply Post New Topic
Author Message
gparul
Newbie
Newbie
Avatar

Joined: 03 Nov 2008
Location: India
Online Status: Offline
Posts: 10
Quote gparul Replybullet Topic: Line graphs in crystal 10
     Posted: 04 Nov 2008 at 9:36am
Hi,
 
I am currently working line graphs and i am facing problem displaying trend in the graph when there is no data for aby particular date.
My X-axis have date and y-axis have data.
In actual terms if i select startDate as 1 Oct and endDate as 5th Oct and if suppose i have no data for 3rd oct, the trend should come down, i mean it should display 0 value.
Is it possible. Please help. is urgent.
 
Thanks
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 05 Nov 2008 at 1:01am
Hi
 
Can you post sample data ,so that i can replicate the problem.....
 
Cheers
Rahul
IP IP Logged
gparul
Newbie
Newbie
Avatar

Joined: 03 Nov 2008
Location: India
Online Status: Offline
Posts: 10
Quote gparul Replybullet Posted: 05 Nov 2008 at 9:01am
Hi,
 
The sample data is like this:
 
Date                            Data
1-Oct 2008                    56
2-Oct-2008                    34
4-Oct-2008                    12
 
Now since i selected date from 1st oct to 5th oct. There was no data
for 3rd oct and 5th oct in the database, the graph plotted comes disconnected. there is no continous trend following. How do i represent missing dates data on the graph.
X-axis will have dates and y-axis will have data.
 
Is it possible to represent.  Please help.
IP IP Logged
gparul
Newbie
Newbie
Avatar

Joined: 03 Nov 2008
Location: India
Online Status: Offline
Posts: 10
Quote gparul Replybullet Posted: 07 Nov 2008 at 1:25am
Hi
 
Anyone please help. Its urgent
 
Thanks
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 07 Nov 2008 at 3:10am
Hi,
 
Create a Formula to check for the data code below
 
 
If isnull({table.datafield}) then 0
else
{table.datafield}
 
Then use the formula in the graph istead of data field.
 
Cheers
Rahul
 
IP IP Logged
gparul
Newbie
Newbie
Avatar

Joined: 03 Nov 2008
Location: India
Online Status: Offline
Posts: 10
Quote gparul Replybullet Posted: 07 Nov 2008 at 6:07am
Hi Rahul,
The formula that you have mentioned below checks the database whether  the value corresponding to the date is null or not but our problem is that there is no row for the date itself so this formula does not work in our scenario.
 
Actually I want to display all the dates on x-Axis which is selected by the user.
E.g.  User has selected fromDate and ToDate as 1st Aug to 10th Aug and I have Data as follows
 
08/01/2008 abc
08/03/2008 xyz
08/05/2008 klm
 
 
Currently my graph just shows data for 1st,3rd and 5th of August.
 
I want my Graph to show all the dates from 1stAug to 10thAug on x-axis
and it should not only show  data where it is but also a blank where data is not present
 
Please help. Thank you.
IP IP Logged
gparul
Newbie
Newbie
Avatar

Joined: 03 Nov 2008
Location: India
Online Status: Offline
Posts: 10
Quote gparul Replybullet Posted: 07 Nov 2008 at 6:25am
Hi,
 
Please any1 help me. I need to deliver the report by tomorrow.
 
Thanks
IP IP Logged
gparul
Newbie
Newbie
Avatar

Joined: 03 Nov 2008
Location: India
Online Status: Offline
Posts: 10
Quote gparul Replybullet Posted: 10 Nov 2008 at 4:04am

Hi All,
Thanks to Rahul(rahulwalawalkar) my problem has been solved. Following is the solution to the problem above.

Here HPD_HelpDesk.TT_Created_On is a field in my database where the date on which the TT is created is stored.

 dim thisdate2 as date
dim nextdate2 as date
dim output as string 'output is the text display
dim daysbetween2 as number
dim looptimes2 as number

looptimes2 = 0
daysbetween2 = 0
thisdate2 = Cdate({HPD_HelpDesk.TT_Created_On}) + 1
dim tmpDate as DateTime
tmpDate = nextvalue({HPD_HelpDesk.TT_Created_On})
nextdate2 = cDate(tmpDate)

if nextdate2 - thisdate2 > 0 then daysbetween2 = nextdate2 - thisdate2 else daysbetween2 = 1

do

output = output + monthname(month(thisdate2),true) + "/" + totext(day(thisdate2),0,"") + chr(10)
looptimes2 = looptimes2 + 1
thisdate2 = thisdate2 + 1

if thisdate2 in nextdate2 to {HPD_HelpDesk.TT_Created_On} then formula = output

loop until looptimes2 = daysbetween2


This correspondingly reflects in the graph as well ie. even for dates when there were no TTs created now they are also getting displayed albeit with value equal to 0.

Smile
Parul

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