RE: Master/Detail Report
"Nesler, Thomas J" <[email protected]> Fri, 16 May 2003 11:17:47 -0500
| Newsgroups | gmane.comp.lang.delphi.quick-reports |
|---|---|
| Message-ID | <A787F31512A25E4F9782045CFE320C80152697@NHQ1ACCOEX05VS1.corporate.amfam.com> |
Hi Delpklim! Please don't set your importance level to high. It may be urgent to you but notso much to the world...:-) -----Original Message----- From: delpklim [mailto:[email protected]] Sent: Friday, May 16, 2003 10:31 AM To: [email protected] Subject: [quick-reports] Master/Detail Report Importance: High Hi everyone, I've 2 tables: Customer Table(Master Table) & Video Table(Detail Table). The Video Table is linked to Customer Table through the 'CustNo' field, common to both tables: Customer Table CustNo Name DateBorrowed(yyyymmdd) 001 Susana 20030511 002 Louis 20030624 Video Table CustNo TransRef VideoTitle 001 25841 Lord of the Ring 001 58742 Star Wars 002 65598 The Fugitive 002 85454 Batman At present, I've managed to do up a Master/Detail Report using 1 TADOConnection, 2 TDataSource and 2 TTables, by setting Mastersource of Video Table as DsCustomer & MasterFields as CustNo. My Question is as follows: I want to be selective in choosing a range of date borrowed, in viewing the report. For example, in my TForm2, I want to have 2 DateTimePicker, label as: Start Date & End Date, and 1 Preview Button. When I click Start Date(eg, 20030501) & End Date(eg, 20030530), and click the Preview Button, I'm only able to see 1 record in the report, that is: CustNo Name TransRef VideoTitle 001 Susana 25841 Lord of the Ring 58742 Star Wars Kindly advise me on how to implement the above. Must I use a TADOQuery to link to the Customer DataSource(DsCustomer)? I'm struck here. >>> In your TTable there is a property called Filter. Enter your date ranges there. I am not sure what the format is so you will have to play around with it to get it right. Use the QReport BeforePrint Event to set your filter. Here is an example that I have used for a Paradox database: procedure TArchChkByCat.QuickRep1BeforePrint(Sender: TQuickRep; var PrintReport: Boolean); Var S : String; begin S := 'TransDate >= ' + QuotedStr(BeginDate) + ' and TransDate <= '+ QuotedStr(EndingDate) ; //S is a holder for testing purposes. //Showmessage( S); Expose this line when verifing the string you are sending to your filter. Table1.Active := False; Table1.Filter := S; Table1.Filtered := True; Table1.Active := True; end; Hope this helps, Tom Nesler Live Long!... Code Well!... And Prosper!... V ============================================= QReport Artist 5 - http://www.mensand.com/ The new version is available for Delphi 5.0 , Delphi 4.0 and Delphi 3, BC++Builder 3.0. and BC++Builder 4.0 ============================================= Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ ------------------------ Yahoo! Groups Sponsor ---------------------~--> Get A Free Psychic Reading! Your Online Answer To Life's Important Questions. http://us.click.yahoo.com/Lj3uPC/Me7FAA/uetFAA/i7folB/TM ---------------------------------------------------------------------~-> ============================================= QReport Artist 5 - http://www.mensand.com/ The new version is available for Delphi 5.0 , Delphi 4.0 and Delphi 3, BC++Builder 3.0. and BC++Builder 4.0 ============================================= Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/