Add reports to your apps

From DBReport wiki
Jump to: navigation, search

This tutorial adds a report to existing app. The goal is create a menuItem for design and print. Use the EddiesElectronics desktop app, On "Project chooser" window select Examples, "Sample Applications"/EddiesElectronics/Desktop folder and open EEDesktop.xojo_binary_project file.

Requirements

  • DBReport component.
  • EEDesktop example app.

Walkthrough

  1. Open EEDesktop app from "Project chooser" window.
  2. Add DBReport component.
  3. Add menuItem to File menu on MainMenuBar.
  4. Change Name to "FilePrintCustomers".
  5. Change Text to "Print customers".
  6. Navigate to "Menu Handlers" from CustomerDetailWindow.
  7. Add "Menu Handler" event.
  8. Choose FilePrintCustomers from MenuItem name.
  9. Add code for Designer.
  10. Run App.
  11. Click on "Print customers" from File menu.
  12. Add labels and fields to report.
  13. Close Designer window.
  14. Close App.
  15. Add rpt.Print to FilePrintCustomers event.
  16. Run App.
  17. Click on "Print customers" from File menu.

A video show an example here.

Code for Designer

Dim f As FolderItem= SpecialFolder.Desktop.Child("DBReportTut02.xml")
Dim r As Recordset= App.Orders.FindCustomersByName
 
Dim rpt As New DBReport(f, r)
rpt.Designer
rpt.SaveXML(f)