[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Zero Suppression



Michael,


To do this reliably, I'd convert the number to a string with edit(), and then 
use substr() to look at the last digit and see if it's a zero.  If not, print 
it out fully; if so, print it with a short length. Perhaps like this:

        let $x = edit(#num,'9.999')
        if substr($x,5,1) = '0'
                print $x (,,5)
        else
                print $x (,,4)
        end-if

Dave




At 02:51 PM 9/28/2000 -0700, you wrote:
>Hi Gurus, here is a quick question that I've been playing with for too long.
>
>I am printing a rate field that can be up to 3 digits to the right of the
>decimal. When it is 3 digits I want to print all three, but when there are
>no significant digits, I want to leave blanks.
>
>For example:
>
>If the rate is 2.340 I want to print 2.34
>
>If the rate is 2.345 I want to print 2.345.
>
>I have tried:
>
>  1267    print  #incr_msg_chrg (, {COL75}) edit $$.99BB
>  1268    print  #incr_chr_chrg (, {COL82}) edit $$.99BB
>
>and
>
>  1267    print  #incr_msg_chrg (, {COL75}) edit $$.BBBB
>  1268    print  #incr_chr_chrg (, {COL82}) edit $$.BBBB
>
>But neither work. Any and all helpw will be greatly appreciated.
>
>
>--
>Michael Prodor
><mprodor@qualcomm.com>
>
>Qualcomm - QWBS Info Systems


Dave Donnelly           <dave@isisbio.com>
ISIS BioComp            phone (909) 677-2446      fax (781) 207-5533