Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FieldNotEmpty] seems not working #375

Open
ZioMick opened this issue Nov 27, 2020 · 1 comment
Open

[FieldNotEmpty] seems not working #375

ZioMick opened this issue Nov 27, 2020 · 1 comment

Comments

@ZioMick
Copy link

ZioMick commented Nov 27, 2020

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
Copy link

LeoHazo commented Aug 9, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants