Siebel VB Language Reference > Using Siebel VB > About Formatting Strings >

Numeric Formats


This topic describes numeric formats that you can use with the Set String Format method.

Predefined Numeric Formats

Table 12 describes the predefined numeric formats you can use.

Table 12. Predefined Numeric Formats
Format
Description

General Number

Displays the number without a thousand separator.

Fixed

Displays the number with at least one digit to the left and at least two digits to the right of the decimal separator.

Standard

Displays the number with a thousand separator and two digits to the right of decimal separator.

Scientific

Displays the number using standard scientific notation.

Currency

Displays the number using a currency symbol as defined in the International section of the Control Panel. Uses a thousand separator and displays two digits to the right of decimal separator. Encloses negative value in parentheses.

Percent

Multiplies the number by 100 and displays it with a percentage symbol (%) appended to the right. Displays two digits to the right of the decimal separator.

True or False

Displays FALSE for 0, or TRUE for any other number.

Yes or No

Displays No for 0, or Yes for any other number.

On or Off

Displays Off for 0, or On for any other number.

Custom Numeric Formats

To create a simple custom numeric format, you use one or more digit characters. Siebel VB allows you to use the following digit characters:

  • 0 (zero). Displays a corresponding digit in the output.
  • (#) number sign. If the digit is significant, then it displays it in the output. A significant digit is a digit that resides in the middle of the number or is not zero.

Table 13 includes examples of using zero and the number (#) sign.

Table 13. Examples of Using Zero and the Number (#) Sign
Number
Format
Result

1234.56

#

1235

1234.56

#.##

1234.56

1234.56

#.#

1234.6

1234.56

######.##

1234.56

1234.56

00000.000

01234.560

0.12345

#.##

.12

0.12345

0.##

0.12

As an option, you can use a decimal separator.

A comma instructs Siebel VB to place a comma between every three digits to the left of the decimal separator.

Table 14 includes examples of using a comma.

Table 14. Examples of Using a Comma
Number
Format
Result

1234567.8901

#,#.##

1,234,567.89

1234567.8901

#,#.####

1,234,567.8901

NOTE:  To determine the character to display for a comma or a period, Siebel VB uses the current international settings for your computer. For example, some locales use a period as the decimal separator. Other locales use a comma.

Scaling Numbers

To scale a number, you do one of the following:

  • Insert one or more commas before the decimal separator. Each comma that precedes the decimal separator divides the number by 1000. if you do not specify a decimal separator, then this configuration applies to all digits. A comma does not display in the output string.
  • Include a percentage symbol (%) in the format argument. A percentage symbol multiplies the number by 100. The percentage symbol displays in the output string in the same position as it occurs in the format argument.

Table 15 includes examples of using a comma or a percentage symbol to scale numbers.

Table 15. Examples of Using a Comma or Percentage Symbol to Scale Numbers
Number
Format
Result

1234567.8901

#,.##

1234.57

1234567.8901

#,,.####

1.2346

1234567.8901

#,#,.##

1,234.57

0.1234

#0.00%

12.34%

Inserting Characters In Number Formats

To insert a character in a number in the output string, you enclose the character in double quotes in the format argument. You can also insert a set of characters. Siebel VB inserts the following characters in the output string in a location that matches the position in the format argument:

-  + $ ( space

To configure Siebel VB to insert a single character, you precede the character with a backslash (\).

Table 16 includes examples of using double quotes and backslahes to insert characters.

Table 16. Examples of Using Double Quotes and Backslahes to Insert Characters
Number
Format
Result

1234567.89

$#,0.00

$1,234,567.89

1234567.89

"TOTAL:" $#,#.00

TOTAL: $1,234,567.89

1234

\ = \>#,#\<\ =

= >1,234< =

To insert a quotation mark (") in a format argument, you can use the Get ANSI String method. The character code for a quotation mark is 34. For more information, see Get ANSI String Method.

Scientific Notation Formats

To format a number in scientific notation, you include one of the following exponent strings in the format argument:

  • E-
  • E +
  • e-
  • e +

Siebel VB displays this notation in the following ways:

  • An uppercase e. An uppercase e displays in the output.
  • A lowercase e. A lowercase e displays in the output.
  • A minus sign that follows an uppercase e. A minus sign precedes any negative exponent that displays in the output.
  • A plus sign. A sign always precedes the exponent in the output.

You precede the exponent string with one or more digit characters. The number of digit characters that following the exponent string determines the number of exponent digits in the output.

Table 17 includes examples of using exponential notation.

Table 17. Examples of Using Exponential Notation
Number
Format
Result

1234567.89

###.##E-00

123.46E04

1234567.89

###.##e + #

123.46e + 4

0.12345

0.00E-00

1.23E-01

Using Sections In a Numeric Format

A numeric format can include up to four sections. A semicolon (;) separates each section. The format varies depending on the number of sections you specify:

  • One section. This section applies to every value.
  • Two sections:
    • The first section applies to positive values and zeros.
    • The second section applies to negative values.
  • Three sections:
    • The first section applies to positive values.
    • The second section applies to negative values.
    • The third section applies to zeros.

      If you include semicolons with nothing between them, then Siebel VB uses the format of the first section to print the undefined section.

  • Four sections. Same as three sections, except the fourth section applies to Null values. If you do not include the fourth section, and if the input expression results in a NULL value, then Siebel VB returns an empty string.

Table 18 includes examples of using sections.

Table 18. Examples of Using Sections
Number
Format
Result

1234567.89

#,0.00;(#,0.00);"Zero";"NA"

1,234,567.89

-1234567.89

#,0.00;(#,0.00);"Zero";"NA"

(1,234,567.89)

0.0

#,0.00;(#,0.00);"Zero";"NA#"

Zero

0.0

#,0.00;(#,0.00);;"NA"

0.00

Null

#,0.00;(#,0.00);"Zero";"NA"

NA

Null

"The value is: "

0.00

Siebel VB Language Reference Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Legal Notices.