[FieldNotEmpty] seems not working
ZioMick opened this issue · 1 comments
ZioMick commented
Reading a FixedLengh File I'd like to test that a field must have a non empty value (mandatory).
For this field I've used settings like this:
[FieldFixedLength(1)]
[FieldTrim(TrimMode.Both)]
[FieldNotEmpty]
public string myField1;
But lines where this field is set to "blank" (" ") are not discarded
Could be an issue about the [FieldNotEmpty] attribute or am I using this in the wrong way?
In case of using the AfterRead event, when I test the field it is possible only so set
e.SkipThisRecord = true;
or could be possible to transform this situation in an Error inside the engine.Errors collection?
LeoHazo commented
I ran into a similar issue, and it seems this is how it works. I ended up adding my own validator to determine whether a blank or empty string is allowed.