Class CSVImporter.MappedColumnData
A class holding a single cell of data to be imported for a specific row (CSVImporter.MappedData) and column
Inherited Members
Namespace: LemonEdge.API.Core.Processors.Importing
Assembly: LemonEdge.API.dll
Syntax
public class CSVImporter.MappedColumnData
Constructors
MappedColumnData(string)
Creates a new mapped column data from the specified raw string value from the source file
Declaration
public MappedColumnData(string rawData)
Parameters
Type | Name | Description |
---|---|---|
string | rawData |
Fields
NullValue
The contant used to actually clear the value of a property - <NULL>
If a cell of data is just blank it is ignored and not imported
Declaration
public const string NullValue = "<NULL>"
Field Value
Type | Description |
---|---|
string |
Properties
IsRawValueBlank
Indicates if the specified raw string value is null or empty, effectively blank
Declaration
public bool IsRawValueBlank { get; }
Property Value
Type | Description |
---|---|
bool |
IsRawValueSetToNull
Indicates if the specified raw string value is equal to NullValue
Declaration
public bool IsRawValueSetToNull { get; }
Property Value
Type | Description |
---|---|
bool |
RawData
The raw value from the source file to import
Declaration
public string RawData { get; }
Property Value
Type | Description |
---|---|
string |
Methods
ConvertRawValue(EntityImportColDefinition, string)
Declaration
public static (bool Valid, object Result) ConvertRawValue(EntityImportColDefinition def, string rawData)
Parameters
Type | Name | Description |
---|---|---|
EntityImportColDefinition | def | |
string | rawData |
Returns
Type | Description |
---|---|
(bool Valid, object Result) |
ConvertRawValue<T>(T)
Converts the raw value to the expected data type. If the string raw value can not be converted to the type, then
the defaultIfNotValid
is returned instead
Declaration
public T ConvertRawValue<T>(T defaultIfNotValid)
Parameters
Type | Name | Description |
---|---|---|
T | defaultIfNotValid | A value to return if the original raw string value is not valid for converting to the specified type |
Returns
Type | Description |
---|---|
T | The raw value converted to the expected data type. If the string raw value can not be converted to the type,
then the |
Type Parameters
Name | Description |
---|---|
T | The type to return the data as |
GetAutoKeyRef(IDataMappingPropertyBase)
If the value being imported is an auto increment key, and the raw value is not an integer but a string, then the system needs the string value for other
imports to refer to it by that auto-increment key value.
Declaration
public string GetAutoKeyRef(IDataMappingPropertyBase header)
Parameters
Type | Name | Description |
---|---|---|
IDataMappingPropertyBase | header | A data mapping for this header |
Returns
Type | Description |
---|---|
string | If this value is for an auto increment column, this holds any string key value in the import so other import lines can refer to it by that key |
GetValue(IEnumerable<IDataMappingPropertyBase>, (bool Loaded, bool SetToNull, bool Ignore, object Value)[], IFormulaImporterContext, IDataMappingPropertyBase, Dictionary<string, Guid>)
Returns the value of this raw string value. Takes account of any data mapping overrides or formulas to retrieve the correct value
Declaration
public Task<object> GetValue(IEnumerable<IDataMappingPropertyBase> headers, (bool Loaded, bool SetToNull, bool Ignore, object Value)[] otherData, IFormulaImporterContext retriever, IDataMappingPropertyBase header, Dictionary<string, Guid> autoIncRefs)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IDataMappingPropertyBase> | headers | |
(bool Loaded, bool SetToNull, bool Ignore, object Value)[] | otherData | |
IFormulaImporterContext | retriever | A formula context for evaluating any OverrideValueFormula |
IDataMappingPropertyBase | header | The header mapping for this column |
Dictionary<string, Guid> | autoIncRefs | A dictionary of all custom auto increment keys that have been imported so far |
Returns
Type | Description |
---|---|
Task<object> | The translated, converted, or evaluated value this raw string holds |
IsAutoKeyRef(IDataMappingPropertyBase)
Returns true if the header is an autoincrement column reference
Declaration
public static bool IsAutoKeyRef(IDataMappingPropertyBase header)
Parameters
Type | Name | Description |
---|---|---|
IDataMappingPropertyBase | header | The header to evaluate if the column reference is auto increment or not |
Returns
Type | Description |
---|---|
bool | True if the header is an autoincrement column reference |