A Section report allows to specify a data set and unbound data, using a similar API. You need to just specify DataSet/DataTable/DataView/DataRowCollection/DataRow[] or IList as shown in the DataSource property. For DataSet, you should specify it as shown in the DataMember property.
In addition, a Section report allows to use any unbound data as a data source with the following script logic:
Visual Basic.NET code. Paste inside the class declaration of the report. |
Copy Code
|
---|---|
Private datasource1 As IEnumerator(Of String) = Nothing Dim list As List(Of String)= Nothing |
Visual Basic.NET code. Paste inside the class declaration of the report. |
Copy Code
|
---|---|
Private Function GetIEnumerableData() As IEnumerable(Of String) For i As Integer = 1 To 10 list.Add(String.Format("TestData_{0}", i.ToString())) Next Return list End Function |
C# code. Paste inside the class declaration of the report. |
Copy Code
|
---|---|
private IEnumerator<string> datasource = null; |
C# code. Paste inside the class declaration of the report. |
Copy Code
|
---|---|
private IEnumerable<string> GetIEnumerableData() { for (int i = 1; i <= 10; i++) { yield return string.Format("TestData_{0}", i.ToString()); } } |
Visual Basic.NET code. Paste inside the DataInitialize event. |
Copy Code
|
---|---|
Me.Fields.Add("TestField") Me.list = New List(Of String) datasource1 = GetIEnumerableData().GetEnumerator() |
C# code. Paste inside the DataInitialize event. |
Copy Code
|
---|---|
this.Fields.Add("TestField"); datasource = GetIEnumerableData().GetEnumerator(); |
Visual Basic.NET code. Paste inside the FetchData event. |
Copy Code
|
---|---|
If datasource1.MoveNext() Then Me.Fields("TestField").Value = datasource1.Current eArgs.EOF = FalseElse eArgs.EOF = TrueEnd If |
C# code. Paste inside the FetchData event. |
Copy Code
|
---|---|
if (datasource.MoveNext()) { this.Fields["TestField"].Value = datasource.Current; eArgs.EOF = false; } else eArgs.EOF = true; |