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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Days Hours Minutes Seconds - Chart

Status
Not open for further replies.

govmule

MIS
Dec 17, 2002
90
0
0
US
Hello Everyone,

I'm using Crystal Reports XI against a MSSQL 2000 database. I have a report that does a datediff between two date/time fields. Here is the formula:

datediff("s",{activity.new_date},{activity.working_date}); //get the seconds between 2 dates

Then its converted to Days:Hours:Minutes:Seconds using this formula:

numbervar days;
numberVar hrs;
numberVar min;
numberVar sec;
stringVar ddhhmmss;
days:= Truncate(Truncate(Truncate(Average ({@Daily Total Seconds}, {activity.activity_date}, "monthly")/60)/60)/24);
hrs := Remainder(Truncate(Truncate(Average ({@Daily Total Seconds}, {activity.activity_date}, "monthly")/60)/60),24);
min := Remainder(Truncate(Average ({@Daily Total Seconds}, {activity.activity_date}, "monthly")/60),60);
sec := Remainder(Average ({@Daily Total Seconds}, {activity.activity_date}, "monthly"),60);

ddhhmmss := totext(days,0,"") + ":" + totext(hrs,"00") + ":" + totext(min,"00") + ":" + totext(sec,"00");

ddhhmmss

I have the report grouped by a different date, printing monthly. I would like to summarize the Days:Hours:Minutes:Seconds by month at the end of the report. All I can figure out how to do is display this by seconds (using chart wizard). Do any of you have any suggestions. It certainly doesn't have to be a chart.

As always, thank you for the awesome advice and support.
____________________________________________________________
 
I would insert a crosstab that uses date on change of month as the row field, and seconds as the summary (average?). Then select the seconds summary in preview mode->right click->format field->display string->x+2 and add your above formula, but replace:

Average ({@Daily Total Seconds}, {activity.activity_date}, "monthly")

...with:

currentfieldvalue

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top