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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing a report from multiple data sources

Status
Not open for further replies.

amills

Programmer
May 30, 2003
22
US
I'm trying to print a report that list details from (3) different dbfs.

Dbf1 Main client record
Dbf2 Client payments (payment date and amount)
Dbf3 Client comments (comment date, comment text)

The first part of the report list the general info on the client. Then comes a section listing all the payments. Then a section listing all the comments for that case.


Ex.

Name
Address
CSZ

(some other main account info )

Payments

mm/dd/yy $$$$$$
mm/dd/yy $$$$$$
mm/dd/yy $$$$$$
mm/dd/yy $$$$$$

Comments

mm/dd/yy XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
mm/dd/yy XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
mm/dd/yy XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
mm/dd/yy XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
mm/dd/yy XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


Is there a way to create this in the report generator. I've created it to print a text file and can print it to lpt1, however, I can't seem to redirect this report to a network share from the created file. (\\server\laser1)

Any suggestions ?

Andy
 
If you want all the comments to print after all the payments, as it appears in your example, then you can do this with a temporary cursor and a couple Group By expressions with some Print When conditions.

First, create a cursor with all the data for the report:
Code:
SELECT Clients.Name, Clients.Address Clients... ;
      Payments.PayDate as RptDate, Payments.Amount, space(50) as comments, "P" as RecSource ;
   FROM Clients ;
      INNER JOIN Payments on Client.SomeField = Payments.SomeField ;
   UNION ALL ;
      SELECT (same fields from Clients) ;
             Comments.CmntDate as RptDate, 000000.00 as Amount, Comment, "C" as RecSource ;
          FROM Clients ;
             INNER JOIN Comments on Clients.Somefield = Comments.SomeField ;
   INTO CURSOR RptTemp ;
   Order by ClientKey, RptDate
In your report, create a Group By expression on a key field for the client. Put the main client info in the group header for that Group By expression.

Create a second group by on the RecSource field. In the Group Header for that expression, put a textbox with the expression IIF(RecSosurce="P","Payments","Comments").

In the detail band, put a textbox for the RptDate, and a textbox for the Amount. In the amount's Print When, put RecSource="P". Create another textbox that overlays the amount, but this one is for the comment. In the Print When for that textbox, put RecSource="C".


-BP (Barbara Peisch)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top