Please enable JavaScript to view this site.

A-Shell Reference

Navigation: Subroutines > INFLD > INFLD Parameters > type

Numeric Formatting Codes

Scroll Prev Top Next More

Except for  -  (hyphen) and  .  (period), the formatting and miscellaneous codes do not affect the characters which can be entered; rather, they only affect the way the characters are formatted. Note that unless otherwise indicated, formatting codes only affect the way a field is displayed on the screen and not how it is returned to the calling program.

Value

Description

|#

(bar hash) Disables the automatic display of "0" in a numeric field when nothing entered.

-

(hyphen) Allow Minus Sign.

.

(period) Allow Decimal Point.

$

(dollar sign) Currency field.

G

May be useful for aligning decimal points in column of variable precision numbers.

H

Hours field. Like $ but omits the "$" from the display.

M

Thousands Separator.

R

Right Justify Field.

u

LDF-Related Codes.

v

Value Range Checking.

Z

Zero Fill.

 

Additional details below.

 

Allow Minus Sign

[ Type code =  -  (hyphen / minus sign)] May be typed anywhere in the field, but is always displayed (during entry) to the left of the field. On exit, it is redisplayed as a trailing minus sign (for codes $, H, M), and relocated to the beginning for the returned variable. For example, if "1234-" is entered, it will be redisplayed as "12.34-" (assuming decimal points are not allowed) and returned to the calling program as "-1234."

 

Allow Decimal Point

[ Type code =  .  (period)] If used with types $ or H and the decimal point is not entered, places the decimal point to right of last digit entered. For example, if "1234" is entered, it will be redisplayed as "1,234.00". Note that this code affects the action of the opcode parameter. When decimal points are allowed, default decimal points are inserted as actual characters into the returned field. If decimal points are not allowed, default decimal points are inserted in the display but not returned.

Note: prior to A-Shell version 5.1.1199, INFLD always used the  .  (period) character for the decimal point, regardless of the LDF (Language Definition File). As of 5.1.1199, you can add the type code u to force it to use the decimal point character specified in the LDF. Note that even in the latter case, it will accept a period from  the keyboard as equivalent to the defined decimal point character.

See Also

defpt, to set the position of a default decimal point.
maxpt, to limit the number of digits past the decimal point.

 

Thousands Separator

[ Type code = M ] Triggers a numeric thousands separator between every 3 digits to the left of the decimal point in the final redisplay of the field. The actual character used is defined in the language definition table (comma for the USA table). (This is automatic for $ and H fields.)

 

Right Justify Field

[ Type code = R ] Note that unlike most formatting codes, right justify (and zero fill) actually affect the way the field is returned as well as the way it is displayed. Additionally, whenever you preload a field using the R or Z codes, INFLD will automatically strip the leading fill characters prior to the initial display to simply editing.

 

Value Range Checking

[ Type code = v ] setdef parameter must be loaded with a string of the format ",min,max,," where min is the minimum acceptable value and max is the maximum acceptable value. See setdef for more info on proper formatting of range strings. Note that you will probably want to use code s along with v to stifle the "Choices:" message which otherwise appears on the bottom line when setdef is non null.

 

Zero Fill

[ Type code = Z ] Enough leading zeroes will be added to fill the field to the xmax size. Note that unlike most INFLD formatting options, the leading zeroes are actually returned in the field. On preloading a Z field, the leading zeroes are removed prior to editing, except that if the field is blank, one zero is left.

History

2011 January, A-Shell 5.1.1200: INFLD refinement: When using type Z (zero fill), leading zeroes are no longer stripped on entering the field for date fields or form fields. Stripping the leading zeroes in such cases may mess up the alignment of the form or the interpretation of the individual digits in the date.