I've an array like this one:
const int dim = 1000;
double[,] array = new double[dim, dim];
Random ran = new Random();
for (int r = 0; r < dim; r++)
for (int c = 0; c < dim; c++)
array[r, c] = (ran.Next(dim));
DataTable dataTable = new DataTable();
Can I fill the dataTable
with the array
data?
Approach: The DataTables plugin’s column.data option is used to extract data from arrays using the dot notation. The dot (.) is used for accessing arrays or subarrays of the column.data option.
A table must be available on the page for DataTables to use. This examples shows an empty table element being initialising as a DataTable with a set of data from a Javascript array. The columns in the table are dynamically created based on the columns.title configuration option.
At times you will wish to be able to create a table from dynamic information passed directly to DataTables, rather than having it read from the document.
List of (DataRow). Sure. I mean use the List of (List of (String)) in a Add Data Row activity ? Use the internal List (Of String) as a row input I mean ? Because in the Add Data Row activity, the input has to be either an Array or a DataRow. If I use DataRow I can’t fill it in a random order in the previous step…
Try something like this:
var dt = new DataTable();
//AddColumns
for (int c = 0; c < dim; c++)
dt.Columns.Add(c.ToString(), typeof(double));
//LoadData
for (int r = 0; r < dim; r++)
dt.LoadDataRow(arry[r]);
You have to set up the Columns and then load one row at a time using
DataTable.LoadDataRow()
which takes object[]
Check out the example in MSDN page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With