One leading zero to all dollar values less than $1

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
John
Posts: 24
Joined: Thu Aug 10, 2017 3:21 pm

One leading zero to all dollar values less than $1

Post by John »

Hi,

I'd like to know how to have one leading zero to all dollar values less than $1 (ie $0.32 rather than .32)

I've tried:

#oOverduebalance := #OverdueBal.AsDisplayString( EditWord ' , $00. -' )

which works for values less than $1

but obviously doesn't work for values greater than $1 as a value of 20000 displays as $200,000.00

Regards,
John
atostaine
Posts: 696
Joined: Wed Jan 20, 2016 7:38 am

Re: One leading zero to all dollar values less than $1

Post by atostaine »

I haven't tested on LANSA, but in the IBM i world if the field was 5.2 you would use

' 0 . '

Results:

DSPLY 1.22
DSPLY 0.22
DSPLY 200.22
Art Tostaine
John
Posts: 24
Joined: Thu Aug 10, 2017 3:21 pm

Re: One leading zero to all dollar values less than $1

Post by John »

I copied and pasted the currency floating edit mask from one of the fields already defined in the repository and this worked:

#oOverduebalance := #OverdueBal.AsDisplayString( EditWord ' , , $0 . -' )

I was using:

#oOverduebalance := #OverdueBal.AsDisplayString( EditWord ' , $0. -' )

which wasn't working.

Thanks for the help :-)
Post Reply