You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by JD Daniels <jd...@datatrio.com> on 2004/02/29 06:45:24 UTC

Help [Woody] Decimal Format incorrect from binding

This is probably and easy fix.. I am very tired....

I have in a mysql table:

assetRetail DECIMAL (9,2)

My woody Definition:
        <wd:field id="assetRetail">
            <wd:label>Assest Retail $</wd:label>
            <wd:datatype base="decimal"/>
            <wd:convertor variant="number">
                <wd:patterns>
                    <wd:pattern>#########.##</wd:pattern>
                </wd:patterns>
            </wd:convertor>
        </wd:field>

My Woody Binding:
    <wb:value id="assetRetail" path="InventoryItem/assetRetail">
        <wd:convertor datatype="decimal" type="formatting">
            <wd:patterns>
                <wd:pattern>#########.##</wd:pattern>
            </wd:patterns>
        </wd:convertor>
    </wb:value>

The Problem is, when i load a form, the values are formatted incorrectly...
value one 800.00
value two 5984.00

Loads into the input with 800 and 5,984 not 800.00 and 5984.99 as i 
would expect
which means if the user just hits save, 5.00 gets entered into the database.

where in the heck do I stop woody from being so (un)helpful?

JD

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: advanced formatting (Help [Woody] Decimal Format incorrect from binding)

Posted by Bruno Dumon <br...@outerthought.org>.
On Tue, 2004-03-02 at 13:26, leo leonid wrote:
> On Mar 1, 2004, at 7:53 PM, Bruno Dumon wrote:
> >
> 
> > Anyhow, if you want a digit to show up, you should use 0, such as:
> >
> > <wd:pattern>#########.00</wd:pattern>
> >
> > See also here for more information on the patterns:
> > http://java.sun.com/j2se/1.4.2/docs/api/java/text/DecimalFormat.html
> >
> >
> 
> 
> It just would be too cool, if wd:convertor gave you means to control 
> formatting as described for DecimalFormat. I gave up trying to find 
> something equivalent to
> 
> <i18n:number type="currency" currency="de_DE" fraction-digits="0" 
> src-locale="en_US">${priceEUR}</i18n:number>
> 
> that displays my decimal
>                           o  localized
>                           o  in an explicitly defined currency
>                           o  omitting digits behind decimal piont (cents)
> 
> if there is a way to do this, please tell me.

point 1 and 3 should already be possible I think, point 2 could be
added. You could submit a patch or enhancement request to bugzilla for
this.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: advanced formatting (Help [Woody] Decimal Format incorrect from binding)

Posted by leo leonid <te...@leonid.de>.
On Mar 1, 2004, at 7:53 PM, Bruno Dumon wrote:
>

> Anyhow, if you want a digit to show up, you should use 0, such as:
>
> <wd:pattern>#########.00</wd:pattern>
>
> See also here for more information on the patterns:
> http://java.sun.com/j2se/1.4.2/docs/api/java/text/DecimalFormat.html
>
>


It just would be too cool, if wd:convertor gave you means to control 
formatting as described for DecimalFormat. I gave up trying to find 
something equivalent to

<i18n:number type="currency" currency="de_DE" fraction-digits="0" 
src-locale="en_US">${priceEUR}</i18n:number>

that displays my decimal
                          o  localized
                          o  in an explicitly defined currency
                          o  omitting digits behind decimal piont (cents)

if there is a way to do this, please tell me.

thanks
/leo


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Help [Woody] Decimal Format incorrect from binding

Posted by JD Daniels <jd...@datatrio.com>.
Bruno Dumon wrote:

>On Mon, 2004-03-01 at 20:03, JD Daniels wrote:
>  
>
>>Bruno Dumon wrote:
>>
>>    
>>
>>>On Sun, 2004-02-29 at 06:45, JD Daniels wrote:
>>> 
>>>
>>>      
>>>
>>>>This is probably and easy fix.. I am very tired....
>>>>
>>>>I have in a mysql table:
>>>>
>>>>assetRetail DECIMAL (9,2)
>>>>
>>>>My woody Definition:
>>>>       <wd:field id="assetRetail">
>>>>           <wd:label>Assest Retail $</wd:label>
>>>>           <wd:datatype base="decimal"/>
>>>>           <wd:convertor variant="number">
>>>>               <wd:patterns>
>>>>                   <wd:pattern>#########.##</wd:pattern>
>>>>               </wd:patterns>
>>>>           </wd:convertor>
>>>>       </wd:field>
>>>>
>>>>My Woody Binding:
>>>>   <wb:value id="assetRetail" path="InventoryItem/assetRetail">
>>>>       <wd:convertor datatype="decimal" type="formatting">
>>>>           <wd:patterns>
>>>>               <wd:pattern>#########.##</wd:pattern>
>>>>           </wd:patterns>
>>>>       </wd:convertor>
>>>>   </wb:value>
>>>>
>>>>The Problem is, when i load a form, the values are formatted incorrectly...
>>>>value one 800.00
>>>>value two 5984.00
>>>>
>>>>Loads into the input with 800 and 5,984 not 800.00 and 5984.99 as i 
>>>>would expect
>>>>which means if the user just hits save, 5.00 gets entered into the database.
>>>>   
>>>>
>>>>        
>>>>
>>>where does the 5.00 come from?
>>>
>>>Anyhow, if you want a digit to show up, you should use 0, such as:
>>>
>>><wd:pattern>#########.00</wd:pattern>
>>>
>>>See also here for more information on the patterns:
>>>http://java.sun.com/j2se/1.4.2/docs/api/java/text/DecimalFormat.html
>>>
>>> 
>>>
>>>      
>>>
>>The Datatype in the database is DECIMAL(9,2).. and it truncates it at 
>>the ',' so mysql makes 5,984 into five, and the type is 2 decimal 
>>places, so it then adds .00
>>    
>>
>
>I see.
>
>  
>
>>What I am wondering.. Is where does woody get the bright idea to format 
>>the ',' in for the form input value?
>>
>>(I have tried 0's instead of #'s.. no difference)
>>    
>>
>
>Then it seems like the specified pattern isn't used at all and it falls
>back to the default formatting...
>
>Ah, I see it now: you misplaced the convertor element in the form
>definition, it must be inside the datatype element.
>
>  
>
DOH knew it was right in front o' me :S

thanks!

JD

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Help [Woody] Decimal Format incorrect from binding

Posted by Bruno Dumon <br...@outerthought.org>.
On Mon, 2004-03-01 at 20:03, JD Daniels wrote:
> Bruno Dumon wrote:
> 
> >On Sun, 2004-02-29 at 06:45, JD Daniels wrote:
> >  
> >
> >>This is probably and easy fix.. I am very tired....
> >>
> >>I have in a mysql table:
> >>
> >>assetRetail DECIMAL (9,2)
> >>
> >>My woody Definition:
> >>        <wd:field id="assetRetail">
> >>            <wd:label>Assest Retail $</wd:label>
> >>            <wd:datatype base="decimal"/>
> >>            <wd:convertor variant="number">
> >>                <wd:patterns>
> >>                    <wd:pattern>#########.##</wd:pattern>
> >>                </wd:patterns>
> >>            </wd:convertor>
> >>        </wd:field>
> >>
> >>My Woody Binding:
> >>    <wb:value id="assetRetail" path="InventoryItem/assetRetail">
> >>        <wd:convertor datatype="decimal" type="formatting">
> >>            <wd:patterns>
> >>                <wd:pattern>#########.##</wd:pattern>
> >>            </wd:patterns>
> >>        </wd:convertor>
> >>    </wb:value>
> >>
> >>The Problem is, when i load a form, the values are formatted incorrectly...
> >>value one 800.00
> >>value two 5984.00
> >>
> >>Loads into the input with 800 and 5,984 not 800.00 and 5984.99 as i 
> >>would expect
> >>which means if the user just hits save, 5.00 gets entered into the database.
> >>    
> >>
> >
> >where does the 5.00 come from?
> >
> >Anyhow, if you want a digit to show up, you should use 0, such as:
> >
> ><wd:pattern>#########.00</wd:pattern>
> >
> >See also here for more information on the patterns:
> >http://java.sun.com/j2se/1.4.2/docs/api/java/text/DecimalFormat.html
> >
> >  
> >
> The Datatype in the database is DECIMAL(9,2).. and it truncates it at 
> the ',' so mysql makes 5,984 into five, and the type is 2 decimal 
> places, so it then adds .00

I see.

> 
> What I am wondering.. Is where does woody get the bright idea to format 
> the ',' in for the form input value?
> 
> (I have tried 0's instead of #'s.. no difference)

Then it seems like the specified pattern isn't used at all and it falls
back to the default formatting...

Ah, I see it now: you misplaced the convertor element in the form
definition, it must be inside the datatype element.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Help [Woody] Decimal Format incorrect from binding

Posted by JD Daniels <jd...@datatrio.com>.
Bruno Dumon wrote:

>On Sun, 2004-02-29 at 06:45, JD Daniels wrote:
>  
>
>>This is probably and easy fix.. I am very tired....
>>
>>I have in a mysql table:
>>
>>assetRetail DECIMAL (9,2)
>>
>>My woody Definition:
>>        <wd:field id="assetRetail">
>>            <wd:label>Assest Retail $</wd:label>
>>            <wd:datatype base="decimal"/>
>>            <wd:convertor variant="number">
>>                <wd:patterns>
>>                    <wd:pattern>#########.##</wd:pattern>
>>                </wd:patterns>
>>            </wd:convertor>
>>        </wd:field>
>>
>>My Woody Binding:
>>    <wb:value id="assetRetail" path="InventoryItem/assetRetail">
>>        <wd:convertor datatype="decimal" type="formatting">
>>            <wd:patterns>
>>                <wd:pattern>#########.##</wd:pattern>
>>            </wd:patterns>
>>        </wd:convertor>
>>    </wb:value>
>>
>>The Problem is, when i load a form, the values are formatted incorrectly...
>>value one 800.00
>>value two 5984.00
>>
>>Loads into the input with 800 and 5,984 not 800.00 and 5984.99 as i 
>>would expect
>>which means if the user just hits save, 5.00 gets entered into the database.
>>    
>>
>
>where does the 5.00 come from?
>
>Anyhow, if you want a digit to show up, you should use 0, such as:
>
><wd:pattern>#########.00</wd:pattern>
>
>See also here for more information on the patterns:
>http://java.sun.com/j2se/1.4.2/docs/api/java/text/DecimalFormat.html
>
>  
>
The Datatype in the database is DECIMAL(9,2).. and it truncates it at 
the ',' so mysql makes 5,984 into five, and the type is 2 decimal 
places, so it then adds .00

What I am wondering.. Is where does woody get the bright idea to format 
the ',' in for the form input value?

(I have tried 0's instead of #'s.. no difference)

JD


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Help [Woody] Decimal Format incorrect from binding

Posted by Bruno Dumon <br...@outerthought.org>.
On Sun, 2004-02-29 at 06:45, JD Daniels wrote:
> This is probably and easy fix.. I am very tired....
> 
> I have in a mysql table:
> 
> assetRetail DECIMAL (9,2)
> 
> My woody Definition:
>         <wd:field id="assetRetail">
>             <wd:label>Assest Retail $</wd:label>
>             <wd:datatype base="decimal"/>
>             <wd:convertor variant="number">
>                 <wd:patterns>
>                     <wd:pattern>#########.##</wd:pattern>
>                 </wd:patterns>
>             </wd:convertor>
>         </wd:field>
> 
> My Woody Binding:
>     <wb:value id="assetRetail" path="InventoryItem/assetRetail">
>         <wd:convertor datatype="decimal" type="formatting">
>             <wd:patterns>
>                 <wd:pattern>#########.##</wd:pattern>
>             </wd:patterns>
>         </wd:convertor>
>     </wb:value>
> 
> The Problem is, when i load a form, the values are formatted incorrectly...
> value one 800.00
> value two 5984.00
> 
> Loads into the input with 800 and 5,984 not 800.00 and 5984.99 as i 
> would expect
> which means if the user just hits save, 5.00 gets entered into the database.

where does the 5.00 come from?

Anyhow, if you want a digit to show up, you should use 0, such as:

<wd:pattern>#########.00</wd:pattern>

See also here for more information on the patterns:
http://java.sun.com/j2se/1.4.2/docs/api/java/text/DecimalFormat.html

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org