Article

How to make ABL client use Windows settings for numeric format ?

« Go Back

Information

 
Article Number000075874
EnvironmentProduct: OpenEdge
Version: 11.x
OS: Windows
Question/Problem Description
How to make ABL session take numeric format defined on Windows level ?
How to avoid conversion issues between ABL layers and .NET layers when using .NET UI ?
Steps to Reproduce
Clarifying Information
Use case:
When using .NET forms, the .NET controls do not honor the ABL side's settings. This can cause conversion issues between the two - decimal values may be coverted wrong, or may throw a "Value could not be converted to System.Decimal" exception.
Easiest way to avoid such issues is to make sure both sides use the same decimal grouping /thousands seperator and the same decimal point/decimal seperator.
Error Message
Defect/Enhancement Number
Cause
Resolution
Since the .NET framework itself will default to whatever is set in the Windows regional settings, 2 alternatives to make sure the ABL side uses those same settings:

1. Start session with -useOsLocale startup parameter.

2. In application code, get the .NET settings from the application's culture:
USING System.Globalization.* FROM ASSEMBLY. 
SESSION:SET-NUMERIC-FORMAT(CultureInfo:CurrentCulture:NumberFormat:NumberGroupSeparator,  /* -numsep / SESSION:NUMERIC-SEPARATOR */
                           CultureInfo:CurrentCulture:NumberFormat:NumberDecimalSeparator /* -numdec / SESSION:NUMERIC-DECIMAL-POINT */ ).
(It's recommended to do this in the session's startup procedure.)
 
Workaround
Notes
Attachment 
Last Modified Date11/22/2016 1:49 PM


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