Skip to main content

Class DataTableUtil

Namespace: Workspace.XBR.Xperiflow.Utilities.AdoDataTable

Assembly: Xperiflow.dll

Declaration
public static class DataTableUtil

Methods

Concat(SessionInfo, IEnumerable<DataTable>, int, bool)

Concatenates multiple DataTables together.

Declaration
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
TypeNameDescription
OneStream.Shared.Common.SessionInfosiSession information.
System.Collections.Generic.IEnumerable<System.Data.DataTable>datatablesThe DataTables to concatenate.
System.Int32axisThe axis to concatenate along (0 for rows, 1 for columns).
System.BooleanignoreIndexIf 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.

Declaration
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
TypeNameDescription
OneStream.Shared.Common.SessionInfosiSession information object.
System.Data.DataTabledtThe DataTable to be melted.
System.StringrowKeyThe column name to be used as a row key in the melted table.
System.Collections.Generic.List<System.String>concatKeyColumnsA list of column names whose distinct combinations of values will define new columns in the melted table.
System.StringvalueColumnThe column name whose values will populate the new columns in the melted table.
System.StringconcatKeyColumnsDelimiterThe 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.

Declaration
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:

  1. Validates that all row key columns are string type

  2. Creates composite row keys by concatenating multiple column values

  3. Processes distinct combinations of concat key columns

  4. Builds result schema with separate columns for each row key component

  5. Populates melted table with transformed data

Returns

System.Data.DataTable

A melted version of the input DataTable with composite row keys

Parameters
TypeNameDescription
OneStream.Shared.Common.SessionInfosiSession information object for error handling and logging context
System.Data.DataTabledtThe DataTable to be melted
System.Collections.Generic.List<System.String>rowKeyA list of column names to be used as composite row keys in the melted table
System.Collections.Generic.List<System.String>concatKeyColumnsA list of column names whose distinct combinations of values will define new columns in the melted table
System.StringvalueColumnThe column name whose values will populate the new columns in the melted table
System.StringconcatKeyColumnsDelimiterThe 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

Was this page helpful?