In a , once you connect your report to a data source, in order to get a list of fields to use in the report, you need to add a dataset. Use the following instructions to add a dataset to the report.
These steps assume that you have already added a Page Report template and connected it to a data source. See Adding an ActiveReport to a Project and Connect to a Data Source for further information.
- In the Report Explorer, right-click the data source node (DataSource1 by default) and select the Add Data Set option or select Data Set... from the Add button.
- In the DataSet Dialog that appears, select the General page and enter the name of the dataset. This name appears as a child node to the data source icon in the Report Explorer.
- On the Query page of this dialog, select a Command Type.
- If the Command Type is Text enter a SQL command or XML path in the Query box.
- If the Command Type is StoredProcedure enter the name of the stored procedure in the Query box.
- If the Command Type is TableDirect enter the name of the table in the Query box.
- Click the Validate DataSet icon at the top right hand corner above the Query box to validate the query.
- The fields are automatically added to the Fields page in the DataSet dialog. For XML data, manually enter fields on the Fields page using valid XPath expressions.
- You can also set parameters, filters, and data options on the other pages of the dialog.
- Click the OK button to close the dialog. Your data set and queried fields appear as nodes in the Report Explorer.
|
Note: In case you are using an XML data source provider, you have to provide an XML path on the Query page and generate fields using XPath expressions on the Fields page of the DataSet dialog. See the following example for details.
Query and Field settings for XML Data
The XML provider supports the use of XPath 1.0 in building queries and selecting Fields. Following is an example of how the query string and fields are set with an XMLData connection string.
Connection String
Example of an XmlData connection string.
XmlData=<people>
<person>
<name>
<given>John</given>
<family>Doe</family>
</name>
</person>
<person>
<name>
<given>Jane</given>
<family>Smith</family>
</name>
</person>
</people>;
Query String
Set the query like /people/person/name
Fields
Once the query is set, build the Fields collection with two fields that contain the following name and value pairs:
Name: Given; Value: given
Name: Family; Value: family
See Use Fields in Reports to understand fields further.
|
See Also