interval type
Posted in 1995
Topics: General Discussion
I would like to thank everyone who tried to help with my interval addtion problem. The best solution for me is found below, it was provided by Dennis J. Pimple dennisp@informix.com. I don't know why it works but it does :-) I assume it has to do with the null initialization and null checking ? thanks again Bert ************************************************************************ 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: callduration interval hour to second DEFINE rpt record like callrecord.* 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 ...