🎛️TransformDataContext

ProcessRows

Processes each row in the table using the provided filter predicate and data processor actions.

Parameters:

  • isValid: A function that returns a boolean indicating if the process is valid.

  • FilterPredicate: A function to filter input rows.

  • DataProcessor: An action to process each row.

Example:

Func<bool> isValid = () => true;
Func<DataRow, bool> filterPredicate = row => row.Field<int>("ID") > 10;
Action<DataRow, long> dataProcessor = (row, index) => Console.WriteLine(row);

data.ProcessRows(isValid, filterPredicate, dataProcessor);

ProcessTable

Processes the entire table using the provided data processor action.

Parameters:

  • isValid: A function that returns a boolean indicating if the process is valid.

  • DataProcessor: An action to process the table.

Example:

ProcessRowsOfClass

Processes each row of the table by converting it to a target class. It sends non-null rows to the data processor.

Parameters:

  • isValid: A function that returns a boolean indicating if the process is valid.

  • DataProcessor: An action to process each row.

Example:

ParallelRowFilter

Filters rows in parallel based on the provided predicate.

Parameters:

  • predicate: A function to filter rows.

Example:

ColumnNullOrEmptyFilter

Checks if a column value in a row is null or empty.

Parameters:

  • row: The data row.

  • column: The column name.

Example:

EachColumnWithType

Iterates over each column and uses the callback if the column type is valid.

Parameters:

  • row: The data row.

  • columns: A dictionary of column names and boolean values.

  • t: The type to validate.

  • FilterNulls: If true, no callback is given on null values.

  • col: A callback function.

Example:

EachColumn

Iterates over each column in the dictionary and casts the value to the specified type.

Parameters:

  • row: The data row.

  • columns: A dictionary of column names and boolean values.

  • FilterNulls: If true, no callback is given on null values.

  • col: A callback function.

Example:

RequiredColumns

Checks if the specified columns exist.

Parameters:

  • ColNames: The column names.

Example:

RequiredColumnsOR

Checks if at least one of the specified column exists.

Parameters:

  • ColNames: The column names.

Example:

AnyColumnsOfType

Checks if any columns exist of the specified types.

Parameters:

  • type: The types to check for.

Example:

ColumnsOfType

Returns a list of columns that are of the specified types.

Parameters:

  • type: The types to check for.

Example:

ColumnExists

Checks if a column exists.

Parameters:

  • name: The name of the column.

Example:

ColumnName

Gets the column name from the target column name.

Parameters:

  • name: The target field name.

Example:

ToClass

Converts a data row to a specified class.

Parameters:

  • r: The data row.

  • UseTargetFieldName: If true, maps through the mapping specification.

  • Clean: Outputs if the row could be completely converted.

  • uncleanColumnNames: Outputs the list of names of the columns that failed to convert.

Example:

ToClassList

Converts the entire data table to a list of specified classes.

Parameters:

  • filterNull: If true, filters out null converted items.

Example:

GetValue

Gets a value from a data row by the map target name and converts it to the specified type.

Parameters:

  • row: The data row.

  • name: The name of the target column.

  • val: Outputs the value.

Example:

SetAndValidateValue

Sets and validates a value of a row.

Parameters:

  • row: The data row.

  • column: The target column name.

  • val: The value to set.

Example:

SetAndValidateValueOrReport

Sets and validates a value of a row and generates a report if it fails.

Parameters:

  • row: The data row.

  • column: The target column name.

  • val: The value to set.

Example:

ValidateValue

Validates that a new value is valid against the map restrictions for any given column.

Parameters:

  • columnName: The name of the column.

  • value: The value to validate.

Example:

DataSet Methods (ONLY valid in set level transforms)

ContainsAssociatedSets

Checks if all specified data sets are present.

  • Parameters:

    • TransformOnly (bool): If true, only transformed tables are returned. Default is true.

    • SourceOnly (bool): If true, only source (untransformed) tables are considered. Default is false.

    • names (string[]): Names of the sets.

  • Returns: A boolean indicating whether all specified sets are present.

Example:

ContainsAssociatedSet

Checks if a specified data set is present.

  • Parameters:

    • name (string): Name of the set.

    • TransformOnly (bool): If true, only transformed tables are returned. Default is true.

    • SourceOnly (bool): If true, only source (untransformed) tables are considered. Default is false.

  • Returns: A boolean indicating whether the specified set is present.

Example:

AssociatedSets

Retrieves all associated data sets by name.

  • Parameters:

    • name (string): Name of the set.

    • TransformOnly (bool): If true, only transformed tables are returned. Default is true.

    • SourceOnly (bool): If true, only source (untransformed) tables are considered. Default is false.

  • Returns: A list of DataTable objects for the specified sets.

Example:

DataContextFromSet

Creates a data context from a set name.

  • Parameters:

    • name (string): Original table names from the set.

    • TransformOnly (bool): If true, only the transformed tables are considered.

    • SourceOnly (bool): If true, only source (untransformed) tables are considered. Default is false.

  • Returns: A list of TransformDataContext objects for the specified sets.

Example:

SetToClass

Converts the first available set to an enumerable of a specified type.

  • Parameters:

    • T (type): Type to which the set will be converted.

    • originalName (string): Original name of the transform sets.

    • TransformedOnly (bool): If true, only transformed tables are returned. Default is true.

    • SourceOnly (bool): If true, only source (untransformed) tables are considered. Default is false.

    • filterNull (bool): If true, will filter out null rows. Default is false.

  • Returns: An enumerable of tuples containing the data of type T, a boolean indicating cleanliness, and a list of unclean column names.

Example:

ForEachSet

Iterates over each set looking them up by original name.

  • Parameters:

    • originalName (string): Original name.

    • Callback (Action): Callback per set.

    • TransformedOnly (bool): If true, only transformed tables are considered.

    • SourceOnly (bool): If true, only source (untransformed) tables are considered. Default is false.

Example:

Last updated