You can format numeric values in a predefined (standard) format or in a format that you define (custom).
Contents [Hide] |
The formats featured in this topic only apply to these GainSeeker modules:
GainSeeker Charts
Dynamic Reports 2 and Dynamic Reports
The formats for SPC Data Entry, DMS Data Entry, SPC Charts and Reports, DMS Charts and Reports, and Enterprise Dashboard modules are likely to differ from those featured in this topic. See Numeric formats for information that applies to these GainSeeker modules.
The following table identifies the predefined numeric format names. Only those commonly used with GainSeeker are featured. For information on other formatting options, see the Microsoft .Net documentation. Also see Numeric format examples below in this topic.
Format Specifier |
Format name |
Description |
G or g | General | Display number with no digit grouping symbol |
C or c | Currency | Display number with currency symbol. Display digit grouping symbol if appropriate, and display a number of digits to the right of decimal symbol. Output is based on the workstation's regional options. |
F or f | Fixed-point | Display digits to the left and to the right of the decimal symbol based on the workstation's regional options. |
N or n | Number | Display number with digit grouping symbol and digits to the left and the right of the decimal symbol based on the workstation's regional options. |
E or e | Scientific (exponential) | Use standard scientific notation. |
D or d | Decimal | Display numbers to the right of the decimal symbol (0–9). |
X or x | Hexadecimal | Display characters 0–9 to represent those respective values, followed by characters A–F to represent values of 10–15. |
P or p | Percent | Display number multiplied by 100 with a percent sign (%) appended to the right. |
The following table identifies characters you can use to create user-defined number formats. Only those commonly used with GainSeeker are featured. For information on other formatting options, see the Microsoft .Net documentation. Also see Numeric format examples below in this topic.
Format Specifier |
Format name |
Description |
0 | Zero placeholder | Digit
placeholder. If the value formatted has a digit in the position
where the 0
appears
in the format string, that digit is copied to the result string.
The position of the leftmost 0
before
the decimal point and the rightmost 0
after
the decimal point determines the range of digits that are always
present in the result string.
(The 00 specifier causes the value to round to the nearest digit preceding the decimal.) |
# | Digit placeholder | Display
a digit or nothing. If the expression has a digit in the position
where the # appears in the format string, display it; otherwise,
display nothing in that position. This symbol works like the
0 digit
placeholder, except that leading and trailing zeros are not displayed
if the number has the same or fewer digits than there are # characters
on either side of the decimal symbol in the format expression. (The 00 specifier causes value to round to the nearest digit preceding the decimal.) |
. | Decimal point | Decimal placeholder. The first " . " character in the string determines the location of the decimal separator in the formatted value whereas additional " . " characters are ignored. The actual character used as a decimal placeholder in the formatted output depends on the decimal symbol in the workstation's regional options. |
% | Percentage placeholder | The expression is multiplied by 100. The % character is inserted in the position where it appears in the format string. The actual character used as a percentage placeholder in the formatted output depends on the percentage symbol in the workstation's regional options. |
, | Thousand separator and number scaling | Digit
grouping placeholder and number scaler. The digit grouping symbol
separates thousands from hundreds within a number that has four
or more places to the left of the decimal symbol. Standard use
of the digit grouping symbol is specified if the format contains
a digit grouping symbol surrounded by digit placeholders (0 or
#). Two adjacent digit grouping symbols or a digit grouping symbol
immediately to the left of the decimal symbol (whether or not
a decimal is specified) means "scale the number by dividing
it by 1000, rounding as needed." For example, you can use
the format string "##0,," to represent 100 million as
100. Numbers smaller than 1 million are displayed as 0. Two adjacent
digit grouping symbols in any position other than immediately
to the left of the decimal symbol are treated simply as specifying
the use of a digit grouping symbol.
The actual character used as the digit grouping placeholder in the formatted output depends on the digit grouping symbol in the workstation's regional options. |
\ |
Escape character | Display the next character in the format string (with C# and C++ languages). To display a character that has special meaning as a literal character, precede it with a backslash (\). The backslash itself isn't displayed. Using a backslash is the same as enclosing the next character in double quotation marks. To display a backslash, use two backslashes (\\). Examples of characters that cannot be displayed as literal characters are the date-formatting and time-formatting characters (a, c, d, h, m, n, p, q, s, t, w, y, / and :), the numeric-formatting characters (#, 0, %, E, e, comma, and period), and the string-formatting characters (@, &, <, >, and !). |
E)
E+0 E-0 e0 e+0 e-0 |
Scientific notation | Scientific format. If the format expression contains at least one digit placeholder (0 or #) to the right of E-, E+, e-, or e+, the number is displayed in scientific format and E or e is inserted between the number and its exponent. The number of digit placeholders to the right determines the number of digits in the exponent. Use E- or e- to place a minus sign next to negative exponents. Use E+ or e+ to place a minus sign next to negative exponents and a plus sign next to positive exponents. |
; | Section separator | Separate sections for positive, negative, and zero numbers in the format string. |
'ABC' "ABC" |
Literal string | Characters enclosed in single or double quotes are copied to the result string, but do not affect formatting. |
The following table contains some sample format expressions for numbers. The first column contains the format strings that can be used; the other columns contain the resulting output for various data values and regional options.
Data to be formatted ► |
Positive 5 |
Negative 5 |
Decimal .5 |
Format string ▼ |
Output when regional options are set to English (United States): |
||
C |
$5.00 |
($5.00) |
$0.50 |
P |
500.00% |
-500.00% |
50.00% |
Zero-length string ("") |
5 |
-5 |
0.5 |
0 |
5 |
-5 |
1 |
0.00 |
5.00 |
-5.00 |
0.50 |
#,##0 |
5 |
-5 |
1 |
#,##0.00 |
5.00 |
-5.00 |
0.50 |
$#,##0;($#,##0) |
$5 |
($5) |
$1 |
$#,##0.00;($#,##0.00) |
$5.00 |
($5.00) |
$0.50 |
Currency |
$5.00 |
($5.00) |
$0.50 |
0% |
500% |
-500% |
50% |
0.00% |
500.00% |
-500.00% |
50.00% |
0.00E+00 |
5.00E+00 |
-5.00E+00 |
5.00E-01 |
0.00E-00 |
5.00E00 |
-5.00E00 |
5.00E-01 |
Also see Date/Time formats used for GainSeeker Charts, Dynamic Reports 2, and Dynamic Reports.