FlatFile icon indicating copy to clipboard operation
FlatFile copied to clipboard

Fails to parse delimited row if last field is empty

Open robertlevy opened this issue 10 years ago • 0 comments

I've got this class:

    [DelimitedFile(Delimiter = "|", Quotes = "\"", HasHeader = true)]
    class SchemaRow
    {
        [DelimitedField(1)] public int Ordinal {get; set;}
        [DelimitedField(2)] public Guid GUID { get; set; }
        [DelimitedField(3)] public string KeyItem { get; set; }
        [DelimitedField(4)] public string SNLxlKeyField {get;set;}
        [DelimitedField(5)] public string ProductCaption { get; set; }
        [DelimitedField(6)]  public string DataType { get; set; }
        [DelimitedField(7, NullValue="|")] public string Magnitude { get; set; }
        [DelimitedField(8, NullValue = "|")] public int? Length { get; set; }
    }

It blows up parsing this row where the last 2 fields happen to be empty. I can't seem to find a value to set on the NullValue attribute parameter to make this work. Rows where the last field is populated but the second-to-last field is empty work fine.

5|40F7CE96-DC46-4EFC-AAC4-C76199C1E769|1403|132092|End of Fiscal Period Date|smalldatetime||

robertlevy avatar Jul 02 '15 16:07 robertlevy