Precisely Speaking
February 04, 2012, 06:29:54 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: So what's news with you?  Tell us about it in "Getting To Know You"!
 
   Home   Help Calendar Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Controlling Break Fields for "Totals Only" in Report Definitions  (Read 3208 times)
Tom Pellitieri
Rock Star
*****
Posts: 165


Tom Pellitieri - Toledo, Ohio


« on: October 22, 2007, 01:01:12 PM »

While SB+ provides many report parameters as @RV.xxx (stored in common variable OTHER( 8 )), one of the useful items that is not available is the "Totals Only" flag.  I usually use the break lines to provide nice formatting/spacing, but this format looks terrible if someone chooses to run a Totals Only report instead of a Detail report.  In the past, I've had to write two different reports.  I just found a way to provide the control I need in a single report.

There are two @RV.xxx items that make this possible.  @RV.LINE has the detail line to be printed.  @RV.BREAK.CNT has a sequential break section number to print.  If both of these are 1, it means that the first break section is being printed as the first line of the report.  I found I could use this to control my break sections.

First, in the Process at Start for the report, I need to set a control flag, e.g., USERDATA(1), to zero.  Then, in the Process Before Break slot, I added this test [Edit:  Added @RV.PAGE]:

IF (@RV.PAGE+0) = 0 AND @RV.LINE = 1 AND @RV.BREAK.CNT = 1 THEN @USERDATA(1) = 1

At this point, @USERDATA(1) can be tested as a "Totals Only" flag.

Here's a sample of how this is useful.  I have a report that prints Invoices for a Customer.  The (trimmed) layout is:


C Cust #  Invoice #  Invoice Amount
D XXXXXX  XXXXXXXXX  999,999,999.99
B                    --------------
B XXXXXX  Total      999,999,999.99
B
G                    ==============
G Grand Total        999,999,999.99


With this layout, a detailed report looks great, with "footer" lines before each total.  However, if I run a totals only report, each customer's summary takes three lines, including a leading "footer" line, which looks terrible.  With the new flag, I can close this up by adding Conditional fields on the non-data break lines with this condition:

IF(@USERDATA(1),1,0)

When I do this, the Totals Only report has just one line per customer, and just the single footer before the Grand Total.

[EDIT] If the Grand Total line is on a page by itself, I can also supress the row of Equal Signs by using IF(@RV.LINE=1,1,0)

Personally, I think IBM should add this flag to @OTHER( 8 )/@RV.xxx list, but at least there's a solution available until that happens.

--Tom Pellitieri
« Last Edit: October 23, 2007, 08:36:21 AM by Tom Pellitieri » Logged
precisonline
President/Chief Technologist
Administrator
Rock Star
*****
Posts: 1524



WWW
« Reply #1 on: October 23, 2007, 07:57:18 AM »

CLEVER, man!  Thanks for sharing!
Logged

-Kevin
Accidents "happen"; success, however, is planned and executed.
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!