Hi Mike, To allow a hyphen to occur anywhere within a 3-character field I specified this:
dfdl:nilValue="-%SP;%SP; %SP;-%SP; %SP;%SP;-" But that failed with the dreaded “Left over data” error message. Conversely, both of these succeeded: dfdl:nilValue="%WSP*;-%WSP*;" dfdl:nilValue="%WSP*;-" Why is that? /Roger From: Mike Beckerle <mbecke...@apache.org> Sent: Tuesday, January 2, 2024 11:58 AM To: users@daffodil.apache.org Subject: [EXT] Re: How to specify that the nilValue can occur anywhere within a fixed field? Tricky! For strings we typically justify left, meaning we trim padding characters on the right, i. e. , textStringJustification="left". That means if your data is "- " or " - ", then the spaces on the right side Tricky! For strings we typically justify left, meaning we trim padding characters on the right, i.e., textStringJustification="left". That means if your data is "- " or " - ", then the spaces on the right side are trimmed away before comparison against the "%WSP*;-" nilValue is done. However, for numbers we typically justify right, meaning we trim on the left, ie., textNumberJustification="right". In that case "- " or " - " would not be trimmed on the right side, but on the left, leaving them with spaces after the hyphen, so "%WSP*;-" won't match them. So, the rationale for suggesting "%WSP*;-%WSP*;" i.e., with WSP* on both sides, is so that your nilValue matching conventions are insensitive to type and to whether you use text justification of left or right. On Fri, Dec 22, 2023 at 8:01 AM Roger L Costello <coste...@mitre.org<mailto:coste...@mitre.org>> wrote: Hi Folks, I have a fixed-length field (3) that has hyphen as the nilValue. The hyphen can be positioned anywhere in the field, e.g., .../- /... .../ - /... .../ -/... What is the right way to specify the nilValue? I specified it this way: dfdl:nilValue="%WSP*;-" and it seems to work just fine. But I was told, “that only allows whitespace before the hyphen; it should be specified this way: dfdl:nilValue="%WSP*;-%WSP*;" What is the correct way? /Roger