Help with decimals numbers.

Richard Kreiss rkreiss at verizon.net
Wed Jan 29 12:24:41 PST 2014



> -----Original Message-----
> From: filepro-list-bounces+rkreiss=verizon.net at lists.celestial.com
> [mailto:filepro-list-bounces+rkreiss=verizon.net at lists.celestial.com] On
> Behalf Of Kenneth Brody
> Sent: Wednesday, January 29, 2014 11:46 AM
> To: Kroboth, Joe; filepro-list at lists.celestial.com
> Subject: Re: Help with decimals numbers.
> 
> On 1/29/2014 11:18 AM, Kroboth, Joe wrote:
> > I have a report that I need to print some numbers.  I always need to
> > print to the hundredths unless the number go out beyond the hundredths
> > then I need to print that number. The number would only ever go out to
> > the 10 thousandths.
> >
> > Examples.
> >
> > 100 -> 100.00
> >
> > 100.1 -> 100.10
> >
> > 100.11-> 100.11
> >
> > 100.111->100.111
> >
> > 100.1111->100.1111
> >
> > .2 -> .20
> >
> > .02 -> .02
> >
> > .22-> .22
> >
> > .222->.222
> >
> > .2222->.2222
> >
> > Is there an easy way to do this? Edit maybe?
> 
> Assuming that the numbers will be left-justified:
> 
>      ["-"] [{N}] ( <.00>@ | "." ( <00>@ | N<0>@ | {N} ) )
> 
> Add a backslash at the start if they are to be right-justified.
> 
> If you need the decimals to be aligned, that will take some more work.

Ken,

I previously sent him off list an edit written for me by Small Computer (maybe you did it) which aligns the decimal point in the 5th position from the left.

Z      ◄N | <"0">
SP     ◄( N N | <" "> N | <" "><" ">)"." Z Z (N N | N " " | "  " )

This was written for a field (7,.4).  It filled the 3rd and 4th digit with spaces if no value is present.  This allowed alignment of, in this case, selling prices whether $ 1.99 or $10.7525 or $.1625 or $.16 

I have used this edit in a number of places where decimal alignment was need and zero filling the values to the right of the decimal point was not wanted.



Richard Kreiss
GCC Consulting

Office: 410-653-2813







More information about the Filepro-list mailing list