Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

17.03 Define the Dataset Schema File

Define the Dataset Schema File

When designing a report using the Report Expert you assign it an existing data source and it uses this information to determine which fields are available. When you are using the Push Model you don’t have this luxury. Instead, you have to create a dataset schema file that defines the fields and assign it to the report. The report examines the dataset schema and to get a field list.

A dataset schema is a fully compliant XML file that defines the properties of the data source. It has a file extension of ‘.xsd’. Listing 17-1 shows an excerpt of the XML code that is in the dataset file.

Listing 17-1. The XML schema from a dataset file.

<xs:element name=”Customers”></xs:element>
<xs:complextype></xs:complextype>
<xs:sequence></xs:sequence>
<xs:element name=”CustomerID” type=”xs:string”></xs:element>
<xs:element name=”CompanyName” type=”xs:string”></xs:element>
<xs:element name=”ContactName” type=”xs:string” minoccurs=”0″></xs:element>

A dataset schema file can be created in two different ways. The first method uses the Visual Studio IDE and the second way uses the ADO.NET methods to create it. The method you use depends upon your preferences.