Token Formatting - Numeric

You can use .NET formatting specifiers to have data stored in tokens automatically formatted to specified numeric settings. Standard format specifiers can be used to format numbers according to some of the most frequently used choices. Custom format specifers will work for the same options allowed by the standard ones, and also allow you to further customize or combine formatting choices. You can type these specifiers directly in the tokens or use the Token Editor to insert the specifier and test the formatted token.

Example: Lisa is processing order forms. She wants to use the order numbers as document names. The order numbers can have various numbers of digits, so she wants to add leading zeros so the names will be sorted in true numeric order. Currently, the maximum number of digits in an order number is five, but she decides to allow eight digits so she can continue to use the same system well into the future. She can do this using either standard or custom numeric format specifiers. In either case, she can begin by opening the Token Editor and selecting Include Formatting. Then she can use either of the following options:

 Formatting SpecifierResulting TokenResult when tested with "334"
StandardD8%(Order#"D8"#)00000334
Custom00000000%(Order#"00000000"#)00000334

Note: The regional settings such as date and currency are Windows regional settings found in the Control Panel for the computer running Quick Fields.

Standard Numeric Format Specifiers

The following specifiers can be used to format numbers according to standard rules.

Example: Maggie is processing lab reports that include numbers in decimal form that she wants to store as percentages in Laserfiche fields.

Formatting specifierFormatted tokenTest valueResult
P%(Zone 1#"P"#).1212.00 %

 

Specifier Type Function
C or c Currency Formats the value to the local currency settings.
D or d Decimal Formats the part of the number before any decimal point. Specify a minimum number of digits. Example:D8 for a minimum of eight digits. Leading zeroes will be appended to create the appropriate number of digits.
E or e Exponent Specify a number of digits after the decimal point. Example: e4 for four digits after the decimal.
F or f Fixed point Formats the part of the number after the decimal point. Specify the desired number of decimal places. Example: F3 for three digits after the decimal. Zeroes will be used to create the appropriate number if necessary.
P or p Percent Converts the value to a percentage.

Custom Numeric Format Specifiers

The following specifiers can be combined to format numbers to specific patterns.

Example: Homer wants to format the value of a token named Zone 1 so that the numbers before the decimal place have a comma separating the thousands place, if one exists, but does not want to append leading zeroes. He also wants the numbers to have exactly four digits after the decimal, even if that means appending zeroes.

Formatting specifierFormatted tokenTest valueResult
#,###.0000%(Zone 1#"#,###.0000"#)1425.991,425.9900
#,###.0000%(Zone 1#"#,###.0000"#)623.877623.8770

 

Specifier Type Function
0 Zero placeholder Will be replaced if there is a value in that position; otherwise, will appear as a 0 in the result.
# Digit placeholder Will be replaced if there is a value in that position; otherwise, nothing will appear.
. Decimal point Represents the location of the decimal separator. Only the first decimal point in a string will be used.
, Thousand separator and number scaling Can be used to insert commas as a thousands separator in numbers. Also, one or more immediately to the left of the explicit or implicit decimal point can be used to display numbers in terms of some other amount (e.g., 3,000,000 in millions is 3).
% Percentage placeholder Multiplies a number by 100 and inserts a % sign.
E0, E+0, E-0, e0, e+0, e-0 Scientific notation Formats the number using scientific notation. The number of 0 characters indicates the minimum number of digits to output for the exponent.
\ Escape character Causes the following character to be used literally, even if it is otherwise one of the formatting specifiers.
'ABC' or "ABC" Literal string The characters inside the single or double quotes will be used in the result as is, and do not affect formatting.
; Section separator Used to separate formats for positive, negative, and zero numbers in the format string. Using these, you can specify three different types of formats to be applied depending on the type of number.

For more information on .NET numeric formatting specifiers, see the Microsoft Developers' Network (MSDN) site: