Working with standard formats
The appearance of data in a column depends on the following factors:
*How the data is stored
*The locale to which the system is set
*The format, if any, set by the template or theme
Report Studio provides common formats that control the appearance of data in a column. The formatting options available depend on the type of data in a column. Common types of data include numeric data, string data, and date‑and‑time data. The following section describes how to work with standard, custom, and predefined data formats in a BIRT design.
Once you apply a number, date‑and‑time, or string format to a column of data, you can restore the original format that the data source specifies. To do so, select the column, choose Format Data, and select Unformatted.
Applying a standard number format
Report Studio provides common formats you can use to change how numbers appear. You can, for example, display numbers with or without decimal values, in scientific notation, as a percentage, or with a currency symbol.
Even when a column displays numbers, the data in the column can be of string type. Postal codes, for example, are frequently stored as string data. Numeric formats do not apply to numbers of string type. When you select a column for formatting, the title of the formatting dialog box tells you what type of data the column contains. The available formatting options in the menu are standard formats.
How to apply a number format
1 Select the column containing numeric data.
2 Choose Format Data.
3 In Number Column Format, select a format from the drop‑down list, as shown in Figure 6‑3. You can select a standard format or define a custom format.
Figure 6‑3 Formats for numeric data
Table 6‑1 describes the standard number formats that Report Studio supports. The examples in the table reflect the English (United States) locale. If you work in a different locale, the data is formatted differently. For example, a number that appears as 1352.45 in the English (United States) locale appears as 1352,45 in the French (France) locale. When you select a standard number format, you can set additional formatting options, such as the number of decimal places, the inclusion of a thousands separator, a currency symbol, and so on.
Table 6‑1 Standard number formats
Format
Example of data display
General Number
6066.45 or 6066.5 or 6067, depending on the original value. This format displays up to two decimal places. Whole numbers and numbers with one or two decimal places appear in their original format.
Currency
$6,067.45 or ¥6067 or 6067€, depending on the symbol, symbol position, decimal place, and thousands separator values you set.
Fixed
6067 or 6067.5 or 6,067.45, depending on the decimal place and thousands separator values you set.
Percent
45% or 45.8% or %45, depending on the symbol position and decimal place values that you set. This format multiplies the original value by 100 and adds the percent (%) symbol.
Scientific
2E04 or 2.67E04, depending on the decimal place value you set. The number after the E represents the exponent of 10. For example, 2.67E04 means 2.67 multiplied by 10 raised to the fourth power.
Applying a standard date‑and‑time format
Report Studio provides common formats you can use to change how dates and times appear. You can, for example, display dates as January 19, 2008 11:00:00 AM PST or Jan 19, 2008 or 1/19/08.
How to apply a date‑and‑time format
1 Select a column that contains date‑and‑time data.
2 Choose Format Data.
3 In Date Time Column Format, in Format Date Time as, select a format. You can select a standard format or define a custom format.
The available formats depend on the locale in which you are working. Figure 6‑4 shows the sample formats that appear in the English (United States) locale.
Figure 6‑4 Date‑and‑time formats displayed in English (United States) locale
Applying a standard string format
A column that displays string data displays the data as it is stored in the data source. You can format string data to modify text that contains inconsistent capitalization or to include characters, such as a space or a punctuation mark, at a specific place in the string. For example, you can display telephone numbers in one of the following formats:
(415) 555‑2121
415.555.2121
415‑555‑2121
How to apply a string format
1 Select a column that contains string data.
2 Choose Format Data.
3 In String Column Format, in Format String as, select a format. You can select a standard format or define a custom format. Standard and custom formats are described in the following sections.
Table 6‑2 describes the string formats you can choose and provides examples of how the formatted data appears.
Table 6‑2 Standard string formats
Format
Description
Lowercase
The string displays in all lowercase, for example:
john smith
Uppercase
The string displays in all uppercase, for example:
JOHN SMITH