Article

Infragistics ultraCurrencyEditor adds nonsignificant zero to decimal value after editing

Information

 
Article Number000091514
EnvironmentProduct: OpenEdge
Version: 11.7.x
OS: Windows
Question/Problem Description
Infragistics ultraCurrencyEditor adds nonsignificant zero to decimal value after editing

When modifying Infragistics ultraCurrency editor values, after editing the decimal value is modified such that equality matches no longer work.  Editing the value can add a nonsignificant zero to the ultraCurrency value, which causes equality checks to return FALSE even when the decimal value hasn't changed.  

Initially nonsignificant trailing zeros in the fractional part of the value after the decimal point, are not displayed by the MESSAGE statement.  This is expected.  But after editing, a zero is added which causes the equality match to fail.  For example with the following button trigger code the button checks the initial values of the ultraCurrencyEditors by adding them and calculating the difference:
DEFINE VARIABLE d1 AS DECIMAL FORMAT "$->>>>>>>9.99" NO-UNDO.
DEFINE VARIABLE d2 AS DECIMAL FORMAT "$->>>>>>>9.99" NO-UNDO. 

d1 = ultraCurrencyEditor1:value + ultraCurrencyEditor2:value + ultraCurrencyEditor3:value.
d2 = ultraCurrencyEditor4:value.

MESSAGE "814.98 + 325.79 + 79.13 = " d2 "?" d1 = d2 SKIP(2)
    "814.98 + 325.79 + 79.13 = " d1 SKIP
    "Total value = " d2 SKIP(1)
        
    "Difference:" SKIP
    "(814.98 + 325.79 + 79.13) - " d2 " = " d1 - d2 
    VIEW-AS ALERT-BOX.

User-added image

If the total value is edited and re-entered as the same value (1219.90), then the button used again to check the values, this results in:

User-added image

For some reason the nonsignificant trailing zero is no longer truncated by the MESSAGE statement, and this causes the equality match to fail.
 
Steps to Reproduce
Clarifying Information
Error Message
Defect/Enhancement NumberDefect OCTA-8341
Cause
The exact cause is not known at this time.
Resolution
None at this time.
Workaround
Modify the total value in the calculation to convert it to a string and then back to a decimal when making the equality comparison:
d1 = ultraCurrencyEditor1:value + ultraCurrencyEditor2:value + ultraCurrencyEditor3:value.
d2 = DECIMAL(STRING(ultraCurrencyEditor4:value,"->>>>>>>9.99")).

MESSAGE "814.98 + 325.79 + 79.13 = " d2 "?" d1 = d2 SKIP(2)
    "814.98 + 325.79 + 79.13 = " d1 SKIP
    "Total value = " d2 SKIP(1)
        
    "Difference:" SKIP
    "(814.98 + 325.79 + 79.13) - " d2 " = " d1 - d2 
    VIEW-AS ALERT-BOX.
User-added image

Alternatively use the System.Decimals:Equals method to perform the equality match:
d1 = ultraCurrencyEditor1:value + ultraCurrencyEditor2:value + ultraCurrencyEditor3:value.
d2 = ultraCurrencyEditor4:value.

MESSAGE "814.98 + 325.79 + 79.13 = " d2 "?" System.Decimal:Equals(d1, d2) SKIP(2)
    "814.98 + 325.79 + 79.13 = " d1 SKIP
    "Total value = " d2 SKIP(1)
        
    "Difference:" SKIP
    "(814.98 + 325.79 + 79.13) - " d2 " = " d1 - d2 
    VIEW-AS ALERT-BOX.
User-added image
Notes
Attachment 
Last Modified Date9/13/2018 11:06 AM


Feedback
 
Did this article resolve your question/issue?

   

Your feedback is appreciated.

Please tell us how we can make this article more useful. Please provide us a way to contact you, should we need clarification on the feedback provided or if you need further assistance.

Characters Remaining: 1025