Re: BigDecimal makes display problems

Steve Quirk <[email protected]>
Newsgroups gmane.comp.web.webobjects.devel
Message-ID <[email protected]>
Forget NSNumberFormatter and use the java.text.Format api instead.

In your .wod:
    ...
    formatter = myNumberFormatter;
    ...

In your component (or someplace convenient for saving a user's Locale, 
like Session):

    myNumberFormatter = NumberFormat.getInstance(Locale.GERMANY);
    myNumberFormatter.setMinimumFractionDigits(2);


- sq

On Mon, 20 Mar 2006, WebObjects wrote:

> Hello these are the entries i tried in wod
>
> ----------------------------------------------------------------------------
> -
> RateLowerLimit: WOTextField {
> value = rate.lowerLimit;
> numberformat = "0,##";
> size = 15;
> }
> ----------------------------------------------------------------------------
> -
> RateLowerLimit: WOTextField {
> value = rate.lowerLimit;
> numberformat = "0,00";
> size = 15;
> }
> ----------------------------------------------------------------------------
> -
> RateLowerLimit: WOTextField {
> value = rate.lowerLimit;
> numberformat = "0";
> size = 15;
> }
> ----------------------------------------------------------------------------
> -
> RateLowerLimit: WOTextField {
> value = rate.lowerLimit;
> size = 15;
> }
> ----------------------------------------------------------------------------
> -
>
> All types tried :)
>
> Thanks.
>
>
> ----- Original Message -----
> From: "wojingo" <[email protected]>
> To: "WebObjects" <[email protected]>
> Cc: "Omni group" <[email protected]>
> Sent: Friday, March 17, 2006 12:56 AM
> Subject: Re: BigDecimal makes display problems
>
>
>> Hi,
>>
>> WebObjects wrote:
>>> Hello,
>>>
>>> Anybody could give me a hint about using the number Formatter in
> WOComponent correctly please?
>>>
>>> I have in MS-SQL server an attribute as Money. in EOModel is BigDecimal
>>> The db saves the numbers correct so Number 6 is 6 and 6,5 is 6,5 in the
> db.
>>> ----------------------------------------------------
>>> I tried the following, but still didnt get it work.
>>>
>>> // In Application class.
>>> public Application()
>>>     {
>>>         super();
>>>
>>>         Locale.setDefault(Locale.GERMAN);
>>>         NSNumberFormatter.setDefaultLocale(Locale.GERMAN);
>>>         NSNumberFormatter.setDefaultLocalizesPattern(true);
>>> ....
>>> ----------------------------------------------------
>>> the WO mashine is English windows the Location is Germany
>>> Browers is IE also German setting
>>> ----------------------------------------------------
>>>
>>> I tried almost all compinations.
>>> None Formatter, "0", "0.00", "0.##", "0,00", "0,##",  and so on.
>>> ----------------------------------------------------
>>> The hoped results:
>>> insert 6        keeps 6
>>> insert 6,5        keeps 6,5
>>>
>>> ----------------------------------------------------
>>>
>>
>> What does your wod file bindings look like? And what is the value you
>> are currently seeing displayed?
>>
>> regards,
>> - shaun
>>
>>
>
>
> _______________________________________________
> WebObjects-dev mailing list
> [email protected]
> http://www.omnigroup.com/mailman/listinfo/webobjects-dev
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.