Class DataTableUtil
Namespace: Workspace.XBR.Xperiflow.Utilities.AdoDataTable
Assembly: Xperiflow.dll
public static class DataTableUtil
Methods
Concat(SessionInfo, IEnumerable<DataTable>, int, bool)
Concatenates multiple DataTables together.
public static DataTable Concat(SessionInfo si, IEnumerable<DataTable> datatables, int axis = 0, bool ignoreIndex = false)
Returns
System.Data.DataTable
A DataTable containing the concatenated DataTables.
Parameters
Type | Name | Description |
---|---|---|
OneStream.Shared.Common.SessionInfo | si | Session information. |
System.Collections.Generic.IEnumerable<System.Data.DataTable> | datatables | The DataTables to concatenate. |
System.Int32 | axis | The axis to concatenate along (0 for rows, 1 for columns). |
System.Boolean | ignoreIndex | If true, do not use the index values on the concatenation axis. The resulting axis will be labeled 0, ..., n - 1. |
MeltDataTable(SessionInfo, DataTable, string, List<string>, string, string)
Melts a DataTable by transforming it into a long format where distinct combinations of values found in specified columns define new columns.
public static DataTable MeltDataTable(SessionInfo si, DataTable dt, string rowKey, List<string> concatKeyColumns, string valueColumn, string concatKeyColumnsDelimiter = "~")
Returns
System.Data.DataTable
A melted version of the input DataTable.
Parameters
Type | Name | Description |
---|---|---|
OneStream.Shared.Common.SessionInfo | si | Session information object. |
System.Data.DataTable | dt | The DataTable to be melted. |
System.String | rowKey | The column name to be used as a row key in the melted table. |
System.Collections.Generic.List<System.String> | concatKeyColumns | A list of column names whose distinct combinations of values will define new columns in the melted table. |
System.String | valueColumn | The column name whose values will populate the new columns in the melted table. |
System.String | concatKeyColumnsDelimiter | The delimiter used for concatenating the key column values. Default is "~". |
MeltDataTable(SessionInfo, DataTable, List<string>, List<string>, string, string)
Melts a DataTable by transforming it into a long format where distinct combinations of values found in specified columns define new columns. This version supports multiple columns as composite row keys for complex data restructuring scenarios.
public static DataTable MeltDataTable(SessionInfo si, DataTable dt, List<string> rowKey, List<string> concatKeyColumns, string valueColumn, string concatKeyColumnsDelimiter = "~")
Remarks
This overload of MeltDataTable supports composite row keys, allowing for more complex data transformations where multiple columns together define the unique identifier for each row in the melted table. The method combines the specified row key columns into a single composite key for processing.
Processing Steps:
-
Validates that all row key columns are string type
-
Creates composite row keys by concatenating multiple column values
-
Processes distinct combinations of concat key columns
-
Builds result schema with separate columns for each row key component
-
Populates melted table with transformed data
Returns
System.Data.DataTable
A melted version of the input DataTable with composite row keys
Parameters
Type | Name | Description |
---|---|---|
OneStream.Shared.Common.SessionInfo | si | Session information object for error handling and logging context |
System.Data.DataTable | dt | The DataTable to be melted |
System.Collections.Generic.List<System.String> | rowKey | A list of column names to be used as composite row keys in the melted table |
System.Collections.Generic.List<System.String> | concatKeyColumns | A list of column names whose distinct combinations of values will define new columns in the melted table |
System.String | valueColumn | The column name whose values will populate the new columns in the melted table |
System.String | concatKeyColumnsDelimiter | The delimiter used for concatenating the key column values. Default is "~" |
Exceptions
System.ArgumentException
Thrown when any row key column is not of string type
OneStream.Shared.Common.XFException
Thrown when an error occurs during the melting process
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object,System.Object)
System.Object.GetHashCode
System.Object.GetType
System.Object.MemberwiseClone
System.Object.ReferenceEquals(System.Object,System.Object)
System.Object.ToString