Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding data to chart

Status
Not open for further replies.

lalakeyorai

Technical User
Nov 3, 2009
12
MY
Hi All,
I have a problem and I desperately need help from anyone here. After many weeks comes to months 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;

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_error
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:=(24*3600)-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.
 
I am sorry, did I post this thread into the wrong forum group? Just realized I post it to the wrong forum group. Should I re-post it into the 'Business Objects: Crystal Reports 1 Formulas'?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top