Re: Do you need a "on every row" or "on last row"?
Posted in 1993
>From: walt@mathcs.emory.edu (Walt Hultgren {rmy}) >Subject: Re: Do you need a "on every row" or "on last row"? >Date: 8 Oct 1993 08:57:20 -0400 >X-Informix-List-Id: <news.4540> > >Sounds like some people are talking about Ace and others about I4GL. > >Just for another data point, we've been using I4GL on Suns since ".03", >and perhaps before that (don't remember exactly). I4GL has always worked >for us the way Cathy Kipp describes: if you send no data to a report, >you get no output, even though the report is STARTed and FINISHed. > >We also have Ace here, but I don't do enough work with it to be able >to say for sure. I too worked with good ol' 3.3, and I seem to remember >that on NCR Towers with SysV.2, no data resulted in no report with Ace. >The print spooler on that system used banner pages, so it wasn't too >confusing. At least the user knew when the report was finished. >Most of the serious reports in that system used C with ALL II calls, so >I basically was able to ignore the issue. > >I second Cathy's call for an option to force at least a page header [and >footer] even if no data is sent to a report. An alternate syntax might >be some enhancement to the START REPORT statement, such as > > START REPORT report_name [...] IMMEDIATELY > >or something like that. The modifications required to the report control >routines shouldn't be that bad. I say that of course with having seen >the code, though. I'm not sure anybody is going to like this, but here goes anyway... When I've needed reports to print info about no data found, then I always used an ON LAST ROW clause, as in the example code below. MAIN START REPORT r1 FINISH REPORT r1 END MAIN REPORT r1(i) DEFINE i INTEGER OUTPUT PAGE LENGTH 20 TOP MARGIN 0 BOTTOM MARGIN 0 LEFT MARGIN 0 FORMAT PAGE HEADER PRINT "Page header" PAGE TRAILER PRINT "Page Trailer" ON EVERY ROW PRINT i USING "----------&" ON LAST ROW IF COUNT(*) = 0 THEN PRINT "No data found" ELSE PRINT COUNT(*) USING "<<<<<<<< rows found" END IF END REPORT When run under 2.10.03 or 4.00 (RDS), it produces: No data found {blank lines deleted} Page Trailer Thus, the page header is suppressed if the first data printed was in the ON LAST ROW block. This has always seemed like a bug, but can be handled (coded around) by including the relevant PAGE HEADER printing in the ON LAST ROW / IF COUNT(*) = 0 block. When run under 4.11 (RDS), this produces no output -- zero, zilch, nil, nothing. I'm not keen on this -- it breaks my previously working code. If there is no ON LAST ROW block, then I think there's some justification for not producing any report at all. If there is an ON LAST ROW block and it prints anything, then there should be a page header, what it prints, and a page trailer. No, I don't suppose this'll be fixed in 4.12. And if any of this made anybody happy, let me know. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>