Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Report Hell!
Message
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Title:
Miscellaneous
Thread ID:
00519730
Message ID:
00519932
Views:
9
This message has been marked as a message which has helped to the initial question of the thread.
Nadya

>>How can I make this report to print Group summary + one record from the previous page?


After years of dealing with "interesting" report requirements, I've developed a general methodology that helps keep the contortions to a minimum.

Wrap the report in a program file. In the report prg, do SQL SELECTs as you need them to get the desired report data. In the case of an errant summary record, write a seperate SQL SELECT that creates a "summary" cursor. The report form's summary band will use that cursor (as opposed to the report body cursor).

An additional benefit of a wrapper prg: The report form is scoped as a child of the prg. This means that any functions in the prg are visible to the report form and you can call them via the text controls in the form.

One of the complaints routinely leveled at Fox's report writer is that its so tightly bound to VFP... well this is a case of that tight relationship working to the develper's benefit.

i.e.
* PROGRAM: Frx_Wrap.prg

SELECT * ;
  FROM MyTable ;
  WHERE [report condition] ;
  INTO CURSOR RptMain

SELECT * ;
  FROM MyTable ;
  WHERE [summary condition] ;
  INTO CURSOR RptSummary

SUM CritField TO m.lnCritVal

REPORT FORM MyReport TO PRINT NOCON PROMPT

USE IN RptSummary
USE IN RptMain

RETURN


FUNCTION FullName
LPARAMETERS tcFirstName, tcMI, tcLastName

m.lcRetName = ALLTRIM(m.tcLastName)

IF NOT EMPTY(m.tcFirstName + m.tcMI)
  m.lcRetName = m.lcRetName + ", " + ALLTRIM(m.tcFirstName) + " " + m.tcMI
ENDIF

RETURN(m.lcRetName)

* END Frx_Wrap.prg
In this example, the cursor RptMain is used by the body of the report. Cursor RptSummary and memvar m.lnCritVal are used by the summary band of the report. Function FullName() is called by a display text control in the report body to concatenate the three fields into one formatted value.

Regards,
Thom C.
Previous
Reply
Map
View

Click here to load this message in the networking platform