Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Microsoft: FoxPro FAQ


How to print Multiple Detail bands in a Report by ramani
Posted: 8 Nov 01

** 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

SELECT child2

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 ;

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

Back to Microsoft: FoxPro FAQ Index
Back to Microsoft: FoxPro Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close