First of all you will need to define an object class, which will be used for the report. Windows.Reporting uses object attributes as field values. Let's use the following class for an example:
01using System.Globalization; 02
03
namespace Db4objects.Db4odoc.ReportsExample.Persistent 04
{ 05
class Pilot 06
{ 07
string _name; 08
int _points; 09
10
public Pilot(string name, int points) 11
{ 12
_name = name; 13
_points = points; 14
} 15
16
public int Points 17
{ 18
get 19
{ 20
return _points; 21
} 22
} 23
24
public void AddPoints(int points) 25
{ 26
_points += points; 27
} 28
29
public string Name 30
{ 31
get 32
{ 33
return _name; 34
} 35
} 36
37
override public string ToString() 38
{ 39
return string.Format(CultureInfo.CurrentCulture,"{0}/{1}", _name, _points); 40
} 41
} 42
}
01Imports System.Globalization 02
03
Namespace Persistent 04
05
Class Pilot 06
Private _name As String 07
Private _points As Integer 08
09
Public Sub New(ByVal name As String, ByVal points As Integer) 10
_name = name 11
_points = points 12
End Sub 13
14
Public ReadOnly Property Points() As Integer 15
Get 16
Return _points 17
End Get 18
End Property 19
20
Public Sub AddPoints(ByVal points As Integer) 21
_points += points 22
End Sub 23
24
Public ReadOnly Property Name() As String 25
Get 26
Return _name 27
End Get 28
End Property 29
30
Public Overloads Overrides Function ToString() As String 31
Return String.Format(CultureInfo.CurrentCulture, "{0}/{1}", _name, _points) 32
End Function 33
End Class 34
End Namespace
The Pilot class has Name and Points attributes. These attributes can be used as report fields. If you need more fields to be present in your report you can specify additional attributes in your class or create a custom query class, which can combine information from several objects.
The Pilot class should be built before it will become accessible for reporting.