Page 1 of 1

One leading zero to all dollar values less than $1

Posted: Thu Mar 28, 2019 10:33 pm
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

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

Posted: Fri Mar 29, 2019 3:52 am
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

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

Posted: Fri Mar 29, 2019 11:17 am
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 :-)