Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to print Multiple Detail bands in a Report

Reports

How to print Multiple Detail bands in a Report

by  ramani  Posted    (Edited  )
**********************************************************
** How to print Multiple Detail bands in a Report.
**********************************************************
** by Subramanian.G (ramani)
** FoxAcc Software
** ramani_g@yahoo.com
**********************************************************

You can ceate a combined cursor from child 1 and child 2 and order them according to parentId and as required. Here is an examople

SELECT child1
LOCATE
SCATTER MEMVAR BLANK

SELECT child2
LOCATE
SCATTER MEMVAR BLANK

MyFile = SYS(3)

SELECT "1" as ChildNo, ParentFieldId, ;
child1.*, ;
m.cfild2Field1 as Child2Field1, ;
m.cfild2Field2 as Child2Field2, ;
&& fields of Child2 from MEMVAR BLANK
FROM child1 WHERE conditions ;
UNION ALL SELECT "2" as ChildNO, ParentFIeldId, ;
m.cfild1Field1 as Child1Field1, ;
m.cfild1Field2 as Child1Field2, ;
&& fields of Child1 from MEMVAR BLANK
child2.* FROM child2 WHERE conditions ;
ORDER BY ParentFieldId, ChildNo, etc.. order conditions ;
INTO DBF (MyFile)

Now that you have the cursor of combined Child1 & child2, create a report form with Parent fields in the top and child1 fields in the details band. You can expand the 'detail lines' of the report form to have additional line to hold child2 fields as well. Remember to report each field with WHEN condition of ChildNo="1" or "2" depending on the field being from Child2 or Child1. So the field informations will amount to BLANK when CHild1 or Child2 is empty as selected in the SQL. Also set the "Remove this Line if Blank" checkbox for all. The detailed lines with BLANK can be dropped by this choice in the report Form. As a result you will get only either Child1 or Child2 record in the detail band. The key is that you shall have one detail band line for child table 1 and another for child table 2.

**********************************************************
** Ramani (Subramanian.G), FoxAcc, ramani_g@yahoo.com
** EOF
**********************************************************
Evaluate this to make others know how useful is this :-)

Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top