Reports and recordset

I want to print a report with some values but the values are not stored in a recordset, but in a class.
I tried to construct a recordset and bind the values from the class to fields in the recordset but I got an NilObjectException, because obviously the recordset does not exist. How can I bind the class values to report fields?

Thanks

I guess you could try an in memory database. Look in the language reference for SQLiteDatabase and scroll down to find an example that shows you how to use an in memory database.

Looks like a complicated solution. It must be possible to manually construct a recordset though?

No, it is not.

However if you want to populate a report with values from a class, you don’t need a RecordSet. Just have your class implement the Reports.DataSet interface. This is covered in User Guide Book 3: Framework, Chapter 5: Printing and Reports, Section 3: Displaying Data and Printing Reports.

Also see:

  • Examples/Printing and Reports/Reports/GasReport shows how to use a class that gets its data from a CSV file.
  • Examples/Printing and Reports/Reports/ReportDataListBox for an example of how to use the Interface so that a ListBox can be the source of data for a report.

Hi Paul,

found them already. Thanks. I first try an in-memory database/table.

Alexander, I have a demo of reporting from the contents of a Listbox that I have sent to a number of RS/Xojo folks. It includes a text document that thoroughly explains how it was done. Seeing how it was done using a Listbox it is a simple matter to report from arrays, data classes or any other non-database entity. Just e-mail me at harriew at frontiernet dot net and I will fire it off to you if you would like to see it.