Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: shared variable and chart Post Reply Post New Topic
Author Message
lalakeyorai
Newbie
Newbie


Joined: 01 Nov 2009
Online Status: Offline
Posts: 19
Quote lalakeyorai Replybullet Topic: shared variable and chart
     Posted: 28 Jan 2010 at 9:59am
Hi All,
I have a problem and I desperately need help from anyone here. After many weeks trying to find the solution, now I get really frustrated.
 
These data is already being grouped by Device and Error Type.
 
Device                   Time Occurrence                               Error Type            Error Status
R1                           1/5/2010 12:25:43 PM                        Major Error            Active
R1                           1/5/2010   4:11:50 PM                         Major Error            Cleared
R1                           1/5/2010   2:49:07 PM                         Minor Error            Active
R1                           1/5/2010   2:51:34 PM                         Minor Error            Cleared
R1                           1/5/2010   3:52:37 PM                         Minor Error            Active
R1                           1/5/2010   4:20:31 PM                         Minor Error            Cleared
 
From above data,
A (Major error) time different =3h: 46m: 07s
B (Minor error) time different = 0h: 32m: 11s
C (Time without error) = 24hours – [A+B] = 19h: 41m: 42s
 
I'm trying to create a pie chart with these 3 seconds values (A, B & C). I have no problem to convert the value from string to number (in seconds). But currently, I was only able to display A and B on the pie chart. 
 
Here the syntax that I used to get A and B values displayed.
 
@errortime 
local datetimevar errtime;
local numbervar diff;
{Command.Error_Status}='Active' or
( {Command.Error_Status}='Cleared' and
( onfirstrecord or
{Command.Device}<>previous({Command.Device})));
 
errtime:= if ({Command.Error_Type}= 'Major Error' or {Command.Event_Name}= 'Minor Error')
and previous({Command.Error_Status})='Active' and {Command.Error_Status}='Cleared' then {@Time_Occurence};
 
diff:=  datediff("s",previous({@Time_occurence}), errtime);
 
It will calculate the time different by subtracting time when Status=Cleared with time when Status=Active. So, when it comes to chart, I’ve selected on change of=Command.Error Type, Show Value=sum of @errortime.
 
But I get stuck when I’m trying to add another value which is C (Time without error). I have used syntax with shared variable and place it on a detail section:
 
@w_terror
whileprintingrecords;
shared datetimevar error;
shared numbervar total_diff;
shared numbervar sec;
 
error:= if {Command.Error_Status}='Cleared' and not onfirstrecord then {@Time_Occurence};
 
sec:= if {Command.Error_Status}='Cleared' and not onfirstrecord and {Command.Device}= previous({Command.Device}) then
datediff ('s',previous({@Time_Occurence}),error);
 
total_diff:=total_diff+ sec;
 
then at the footer section I put:
 
@withouterror
whileprintingrecords;
shared numbervar total_diff;
shared numbervar total_diff2;
 
total_diff2:=(86400)-total_diff;
 
It does display the correct value when i drag the formula to the report, but i have no idea how add this 3rd value into the pie chart since @withouterror doesn't appear on the chart Availability field. I did refered to the Charting on Print-Time Formulas, but it makes me more confused. Can someone guide me how to add the 3rd value to the pie chart? what should i do? I am using CR 2008
 
 
thanks in advance.
 


Edited by lalakeyorai - 28 Jan 2010 at 5:41pm
IP IP Logged
lalakeyorai
Newbie
Newbie


Joined: 01 Nov 2009
Online Status: Offline
Posts: 19
Quote lalakeyorai Replybullet Posted: 02 Feb 2010 at 7:17pm
Still no reply... can anybody help me please? hope someone can lead me to find at least a hint to my problem solution. 
 
 
Thanks
IP IP Logged
limcs100
Newbie
Newbie


Joined: 16 Aug 2010
Online Status: Offline
Posts: 1
Quote limcs100 Replybullet Posted: 16 Aug 2010 at 11:24pm
i'm facing the same problem, what is your solution on this ?
IP IP Logged
lalakeyorai
Newbie
Newbie


Joined: 01 Nov 2009
Online Status: Offline
Posts: 19
Quote lalakeyorai Replybullet Posted: 19 Aug 2010 at 5:17pm
Sorry, i'm still didn''t find any solution on this. Tq
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