Re: interval type
Posted in 1995
Topics: Jobs, Consulting & Announcements
Try defining callduration as INTERVAL HOUR(5) TO SECOND, or whatever the appropriate max number of digits for hour would be. If that doesn't work (or it's a RECORD LIKE that you don't want to change), you may have to do the calculation "by hand" instead of using the aggregate functions: DEFINE grp_sum INTERVAL HOUR(5) TO SECOND DEFINE tot_sum INTERVAL HOUR(5) TO SECOND PAGE HEADER IF PAGENO = 1 THEN LET tot_sum = NULL END IF BEFORE GROUP OF rpt.username LET grp_sum = NULL ON EVERY ROW ... IF rpt_callduration IS NOT NULL THEN IF tot_sum IS NULL THEN LET tot_sum = rpt.callduration ELSE LET tot_sum = tot_sum + rpt.callduration END IF IF grp_sum IS NULL THEN LET grp_sum = rpt.callduration ELSE LET grp_sum = grp_sum + rpt.callduration END IF END IF AFTER GROUP OF rpt.username print ... column 35, grp_sum, ON LAST ROW print ... column 35, tot_sum, And so on. ======================================================================= Dennis J. Pimple dennisp@informix.com Opinions expressed Senior Consultant -------------------- are mine, and do not Informix Software Inc Voice: 303-850-0210 necessarily reflect Denver Colorado USA Fax: 303-779-4025 those of my employer. Bert Fonde (baf@ans.net) wrote: : I am trying to print out an interval counter and am not having any luck : printing values > 99 hours. Is their any way to format this ? My code : looks like this, callduration is defined as an interval hour to second : after group of rpt.username : print column 1, username, column 18, "calls", : column 24, group count(*) using "########", : column 35, group sum(rpt.callduration), : column 50, group min(rpt.callduration), : column 60, group max(rpt.callduration), : column 70, group avg(rpt.callduration) : on last row : skip 1 line : print column 1, "Totals", column 18, "calls:", : column 24, count(*) using "########", : column 35, sum(rpt.callduration), : column 50, min(rpt.callduration), : column 60, max(rpt.callduration), : column 70, avg(rpt.callduration) : -- ======================================================================= Dennis J. Pimple dennisp@informix.com Opinions expressed Senior Consultant -------------------- are mine, and do not Informix Software Inc Voice: 303-850-0210 necessarily reflect Denver Colorado USA Fax: 303-779-4025 those of my employer.