Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display Leading Zeros

Status
Not open for further replies.

rstitzel

MIS
Apr 24, 2002
286
US
I have an entry screen where I would like to display the leading zero on a numeric field, but I don't want to show zero balances. What edit code do I use?

Thank you.
 
rstitzel,

I don't know of one (off the top of my head) that will do that. Does this field have decimal places? If not you could change the field to be an alpha field and do someting like:

Code:
Alpha = %EDITC( Num : 'X' );

Which would at least give you the leading zeros.

HTH,
MdnghtPgmr
 
I don't think you can do that with a numeric field, because all edit codes except 'X' supress leading zeros. If it's an output-only field, convert it to character using the %EDITC built-in function:
Code:
/free
  if number <> *ZEROS;
      character = %editc(number:'X');
  else;
      clear character;
/end-free


Me transmitte sursum, Caledoni!

 

Below are the valid (default) edit codes.

Code:
Edit Code                No    CR   -Sign  -Sign
Description              Sign  Sign  (R)    (L) 
                                                
Commas and zero balances    1    A    J    N    
Commas                      2    B    K    O    
Zero balances               3    C    L    P    
No commas or zero balances  4    D    M    Q    
User-defined edit codes     5-9                 
Date edit (4 digits)        W   
Date edit                   Y   
Suppress leading zeros      Z

You can create your own edit code using the CRTEDTD command. As stated above 5 thru 9 are available. This way you can use these in any display or printer file.

I hope this helps...


[thumbsup2]




 
Oops,

forgot the endif; at the bottom.

HitechUser:

CRTEDTD might work, but only if the edit description was created identically on all machines that use it. Plus, if you change the description, you have to recompile all the display/printer files that use it before the new description takes effect.



Me transmitte sursum, Caledoni!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top