ChoETL icon indicating copy to clipboard operation
ChoETL copied to clipboard

ChoFixedLengthReader v1.2.1.48 bool not read

Open Nogrod opened this issue 2 years ago • 2 comments

Updated to version 1.2.1.48 and now my bool fields are always false

Program.cs

using ChoETL;
using ChoETLTest;

foreach (var e in new ChoFixedLengthReader<TestData>("TestData.txt"))
    Console.WriteLine("TestBool1: " + e.TestBool1 + " TestBool2: " + e.TestBool2 + " TestBool3: " + e.TestBool3 + " TestBool4: " + e.TestBool4 + " TestString: " + e.TestString);

TestData.cs

using ChoETL;

namespace ChoETLTest
{
    internal class TestData
    {
        [ChoFixedLengthRecordField(0, 1)]
        public bool TestBool1 { get; set; }
        [ChoFixedLengthRecordField(1, 1)]
        public bool TestBool2 { get; set; }
        [ChoFixedLengthRecordField(2, 1)]
        public bool TestBool3 { get; set; }
        [ChoFixedLengthRecordField(3, 1)]
        public bool TestBool4 { get; set; }
        [ChoFixedLengthRecordField(4, 1)]
        public string TestString { get; set; }
    }
}

TestData.txt

0101a
1111b
1011c
0000d
1000e

image

Nogrod avatar Jul 01 '22 07:07 Nogrod

Set this statement prior to the parser ChoTypeConverterFormatSpec.Instance.BooleanFormat = ChoBooleanFormatSpec.ZeroOrOne;

Cinchoo avatar Jul 01 '22 12:07 Cinchoo

Great, thanks, haven't seen any notes that it is needed now. I remember that tried it already, but after some testing I have seen now that I need it to set for every task on its own, globally didn't work.

Nogrod avatar Jul 01 '22 13:07 Nogrod