Sybase 2 Barcode Reader User Manual


 
Defining display formats
234 DataWindow .NET
Number and currency
settings
To ensure that an application behaves the same in every country where it is
deployed, DataWindow expressions and the masks used in display formats and
edit masks require U.S. notation for numbers. That is, when you specify a
number in a DataWindow expression or in a number mask, a comma always
represents the thousands delimiter and a period always represents the decimal
place. You should also always use the $ sign to represent the symbol for
currency.
At runtime, the locally correct symbols are displayed for numbers and
currency. The comma and period are replaced by the delimiters defined in the
user’s Number settings in the Regional or International Settings property sheet
in the Windows Control Panel. The $ sign in the mask is replaced by the local
currency symbol as defined in the user’s Currency setting in the Windows
Control Panel. For example, in countries where a comma represents the
decimal place and a period represents thousands, users see numbers in those
formats.
Percentages
Use caution when defining an edit mask for a percentage. When you enter a
number in a column with a percent edit mask and tab off the column,
DataWindow Designer divides the number by 100 and stores the result in the
buffer. For example, if you enter 23, DataWindow Designer passes .23 to the
buffer. When you retrieve from the database, DataWindow Designer multiplies
the number by 100 and, if the mask is ##0%, displays 23%.
The datatype for the column must be numeric or decimal to handle the result of
a division by 100. If the column has an integer datatype, a percentage entered
as 333 is retrieved from the database as 300, and 33 is retrieved as 0.
If you use an edit mask with decimals, such as ##0.00%, the datatype must
have enough decimal places to handle the division. For example, if you enter
33.33, the datatype for the column must have at least four decimal places
because the result of the division is .3333. If the datatype has only three
decimal places, the percentage is retrieved as 33.30.
Examples
Table 8-3 shows how the values 5, –5, and .5 display when different format
masks are applied.
Table 8-3: Number display format examples
Format 5 -5 .5
[General] 5 -5 0.5
05-51
0.00 5.00 -5.00 0.50
#,##0 5 -5 1
#,##0.00 5.00 -5.00 0.50