Grooper 21.00.0082 is available as of 12-12-2023! Check the  Downloads Discussion  for the release notes and to get the latest version.
Grooper 23.1.0016 is available as of 03-15-2024! Check the  Downloads Discussion  for the release notes and to get the latest version.
Grooper 23.00.0042 is available as of 03-22-2024! Check the Downloads Discussion for the release notes and to get the latest version.

The Data Field is extracting a different value than the Data Type it is referencing.

kylesouzakylesouza Posts: 156 ✭✭✭
I have an extractor that is finding a currency value using the FuzzyRegEx mode and the pattern of  \$(\*|\*\*|\*\*\*|\*\*\*\*|\*\*\*\*\*|\*\*\*\*\*\*)?(\d{1,3}(,|\.| ))?\d{1,3}(,|\.| )\d{2} with no look around of output format parameters.

This extractor is part of a key-value pair,


 the value extractor gets the correct value, as does the KVP level data type,


but when I run the extraction on the Data Field level it is highlighting the same correct value,


but returning only part of it - making it wrong (pic 4).
Kyle Souza
Data Wizard
P&P Oil & Gas Solutions

Best Answer

  • kylesouzakylesouza Posts: 156 ✭✭✭
    Answer ✓
    I still think there is a problem with the extractors for the dev team to look into, for for now I have found a solution that is working for me; I changed the value pattern to include groups and set an output format.

    Kyle Souza
    Data Wizard
    P&P Oil & Gas Solutions

Answers

  • dearnerdearner Posts: 286 ✭✭✭
    Kyle - out of curiosity, can you post the value type settings for those extractors (KV - Check Amount, Value, and Currency New), including any formatting specifiers?  I'm curious if it's getting clipped somehow to only two digits before the decimal.
  • kylesouzakylesouza Posts: 156 ✭✭✭
    Amount Being Paid


    KV - Check Amount


    Value


    Currency New


    Pattern

    Kyle Souza
    Data Wizard
    P&P Oil & Gas Solutions
  • dearnerdearner Posts: 286 ✭✭✭
    edited January 2020
    Yeah, this is interesting.  So it looks like what's happening here is:
    • your extractor (pre-fix) is picking up "$211 52" for that value, which makes sense; the line is going right through the decimal, and is probably getting removed during IP, so it sees a space. 
    • That gets put through the .NET string formatting with a specifier of c2, defined on your field (there's some reference documentation on it at https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings). 
    • For some reason - and this is something we might want to look into - that is turning it into $52.00.  My guess is it only sees the 52 (which would format as $52.00 with a c2 format specifier); or it sees $211 and 52 separately, and only returns the latter string formatted.
    • That value populates the Grooper field.
    The best practice is the solution you've already found - to explicitly group the dollars and cents, and control the output formatting using the extractor.  This ensures consistent behavior and (again, as you've discovered) good normalization and formatting.
  • RandoCalrisianRandoCalrisian Posts: 195 admin
    I'd like to chime in.
    First off, I'm not really sure what is going on with those asterisks * and or pipes |, but I feel it's being done out of a similar situation as to one listed here:
    https://xchange.grooper.com/discussion/comment/1933#Comment_1933

    Second, the ...
    (,|\.|&nbsp;)<br>could be handled more cleanly with a character set...
    [,. ]<br>
    But, even this part could be cleaned up, and your overall solution more robust by using Fuzzy RegEx.


    Finally, the way the Format Specifier is functioning is correct. It will truncate that space and anything before it. While your work around is getting you there, I felt it necessary to hopefully show you an easier solution, that will work better more frequently, and hopefully get you thinking about Fuzzy RegEx and its uses more.
    Randall Kinard
    rkinard@bisok.com

Sign In or Register to comment.