24-08-22 12:10 PM
how to Use Code stage to copy data to static collection. Pass Input as Collection schema, if not passed then code will create own collection else write data to input collection.
24-08-22 09:45 PM
26-08-22 09:26 AM
26-08-22 12:52 PM
' Create new DataTable instance.
Dim table As New DataTable
' Create 3 typed columns in the DataTable.
table.Columns.Add("FName", GetType(String))
table.Columns.Add("LName", GetType(String))
table.Columns.Add("Email", GetType(String))
' Add a few rows with those columns filled in the DataTable.
table.Rows.Add("John", "Doe", "jdoe@email.com")
table.Rows.Add("Robert", "Johnson", "rj@blahblah.com")
table.Rows.Add("Philip", "Masters", "pmasters@junkmail.com")
' Set our Output data item (i.e. Collection) to the value of the new DataTable
myCollection = table
22-05-23 01:04 PM
@ewilson Do you know what the datatable implementation looks like in the background when you have a collection within a collection? A column in a datatable can only be value types, if im not mistaken?
22-05-23 03:57 PM
@Ivar Buvarp Toft
Here's an example:
// Create the top-level/parent DataTable and define a DataColumn of type DataTable.
DataTable cars = new DataTable();
cars.Columns.Add("Name", typeof(string));
cars.Columns.Add("Specs", typeof(DataTable));
// Define the child DataTable
DataTable carSpecs = new DataTable();
carSpecs.Columns.Add("VIN", typeof(string));
carSpecs.Columns.Add("Model Year", typeof(int));
carSpecs.Columns.Add("Color", typeof(string));
// Populate the child DataTable
carSpecs.Rows.Add("123456789", 1990, "Red");
carSpecs.Rows.Add("987654321", 1965, "White");
carSpecs.Rows.Add("741258963", 2005, "Black");
// Insert the child DataTable into the parent.
cars.Rows.Add("Mustang", carSpecs);
You can take this idea pretty much as deep as you want to go. Just remember that if you want to drill into the values within a child DataTable, you have to make sure to cast the value of the cell containing the child to type DataTable.
Cheers,