Hello, Im new using Xojo and i would like to print a report but without using a database. someone have an idea? I hope you can help me. Thanks
Check out the example projects that come with Xojo, under Printing and Reporting -> Reporting. The ListboxReport example project would be a good place to start.
Victor, send me an e-mail at “harriew at frontiernet dot net” and I will send you a project that shows reporting from data in a listbox. Seeing how that is done it is a no brainer to report from data in arrays, data classes or anything else. An RTF file comes with the project explaining exactly what all needs to be done to accomplish it.
Thank you both so much. Harrie: I will send you an e-mail, thanks.
U can create a variable recordset like this
dim msql as string
Dim inMemoryDB As New REALSQLDatabase
dim rsitem as RecordSet
dim rowdb as DatabaseRecord
excuse post the complete sample code.
[code] dim msql as string
Dim inMemoryDB As New REALSQLDatabase
dim rsitem as RecordSet
dim rowdb as DatabaseRecord
If inMemoryDB.Connect Then
msql = "CREATE TABLE itemlist (codice TEXT, descrizione TEXT, item TEXT, grafico INTEGER, ordinamento INTEGER, femminedevstd DOUBLE, femminemedia DOUBLE, maschidevstd DOUBLE, maschimedia DOUBLE, sezione STRING)"
inMemoryDB.SQLExecute(msql)
if inMemoryDB.Error then
msgbox("errore : " + inMemoryDB.ErrorMessage)
end if
inMemoryDB.Commit()
if inMemoryDB.Error then
msgbox("errore : " + inMemoryDB.ErrorMessage)
end if
rsitem = inMemoryDB.SQLSelect(msql)
rowdb = new DatabaseRecord
rowdb.Column("codice") = rs.Field("cod").StringValue
rowdb.Column("descrizione") = rs.field("descrizione").StringValue + " Maschi"
rowdb.Column("grafico") = rs.Field("grafico").StringValue
rowdb.column("ordinamento") = rs.field("ordinamento").StringValue
rowdb.Column("femminedevstd") = rs.field("femminedevstd").StringValue
rowdb.Column("femminemedia") = rs.Field("femminemedia").StringValue
rowdb.column("maschidevstd") = rs.field("maschidevstd").StringValue
rowdb.Column("maschimedia") = rs.field("maschimedia").StringValue
rowdb.Column("sezione") = rs.Field("nomegrafico").StringValue
rowdb.column("item") = elencoitem(rs.Field("cod").StringValue, self.tipotest,"M")
inMemoryDB.InsertRecord("itemlist",rowdb)
inMemoryDB.Commit()
msql = "select * from itemlist order by grafico, ordinamento"
rsitem = inMemoryDB.SQLSelect(msql)
if inMemoryDB.Error then
msgbox("Errore " + inMemoryDB.ErrorMessage)
end if
rsitem.movefirst
Dim rpt As New rpt_componenti
// Now we select the records from the database and add them to the list.
If rsitem = Nil Then
Beep
MsgBox "Nessun record da stampare."
Else
Dim ps As New PrinterSetup
// set the resolution to 300 DPI for printing
ps.MaxHorizontalResolution = 300
ps.MaxVerticalResolution = 300
If ps.PageSetupDialog Then
Dim g As graphics
g = OpenPrinterDialog(ps, Nil)
If g <> Nil Then
// if the report runs successfully
If rpt.Run( rsitem, ps ) Then
rpt.Document.Print(g)
End If
End If
End If
End If
end if[/code]