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

Crosstab Display String modification

Status
Not open for further replies.

drunk8gods

Technical User
Sep 27, 2013
5
US
Hoping you all can help again.

I have a crosstab on a report footer of my report. It displays users by row, date by column and calculates the average time by seconds. I'm looking for it to display the average time by seconds as a hh:mm:ss format.

Example of how it displays now.

09/01 09/02 09/03
User 01 95 36 14
User 02 46 102 90

What I would like is to display:

09/01 09/02 09/03
User 01 00:01:35 00:00:36 00:00:14
User 02 00:00:46 00:01:42 00:01:30

I've gone into that field and gone into the Display String Settings and have pasted in the following formula:

//WhilePrintingRecords;
//NumberVar TotalSec := {field};
//
//NumberVar Hours := Truncate (Remainder ( TotalSec , 86400) / 3600) ;
//NumberVar Minutes := Truncate (Remainder ( TotalSec , 3600) / 60) ;
//NumberVar Seconds := Remainder (TotalSec , 60) ;
//
//
//Totext ( Hours , '00' ) + ':' +
//Totext ( Minutes , '00' ) + ':' +
//Totext ( Seconds , '00' )

Typically this would work to convert it to the hh:mm:ss format I want, but it isn't working correctly. If I place my crosstab in the report header, it repeats the first hh:mm:ss entry from the first ticket on the report for all the crosstab field entries. If I place the crosstab in the report footer, it repeats the value from the last ticket on the report.

I've uploaded screenshots to an imgur url hoping this will clarify my issue.


 
Just figured it out on my own. In the formula, I just need to replace the {field} value with currentfieldvalue.

//WhilePrintingRecords;
//NumberVar TotalSec := CURRENTFIELDVALUE;
//
//NumberVar Hours := Truncate (Remainder ( TotalSec , 86400) / 3600) ;
//NumberVar Minutes := Truncate (Remainder ( TotalSec , 3600) / 60) ;
//NumberVar Seconds := Remainder (TotalSec , 60) ;
//
//
//Totext ( Hours , '00' ) + ':' +
//Totext ( Minutes , '00' ) + ':' +
//Totext ( Seconds , '00' )

Wanted to post the solution in case anyone gets stuck like I was.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top