Registering DataTable with child Tables in code

edited September 2021 in FastReport .NET

Hi all,

I'm trying to use multiple Data Tables in a single MSChart. To do this I made a parent DataTable to contain all my other tables:

from ReportTemplate.frx:

<TableDataSource Name="AllData" ReferenceName="AllData" DataType="System.Int32" Enabled="true">
      <TableDataSource Name="A" ReferenceName="AllData.A" DataType="System.Int32" Enabled="true">
        <Column Name="X" DataType="System.Double"/>
        <Column Name="Y" DataType="System.Double"/>
      </TableDataSource>
      <TableDataSource Name="B" ReferenceName="AllData.B" DataType="System.Int32" Enabled="true">
        <Column Name="X" DataType="System.Double"/>
        <Column Name="Y" DataType="System.Double"/>
      </TableDataSource>
</TableDataSource>

When I register Data non-hierachical Data, I do it as follows:

//...
DataSet dataSet = new DataSet();

DataTable dataA = new DataTable();
DataTable dataB = new DataTable();
dataA.TableName = "A";
dataB.TableName = "B";

DataTable[] dataArray = new DataTable[]{ dataA, dataB, };


foreach (var table in dataArray)
{
    table.Columns.Add("X", typeof(double));
    table.Columns.Add("Y", typeof(double));
}

dataSet.Tables.AddRange(dataArray);

// Add rows to the tables containing the desired data
//...

report.RegisterData(dataSet, "DataSet");

//...

How can I register the table "AllData" that contains "A" and "B"?

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.