bs Format Numbers

 

Numeral fields

 

The format of placeholders is written into the placeholder mask separated by comma:

<myvalue,format, format-info>

 

Beas ALWAYS uses the thousand-separator and the decimal-separator which is currently set in Windows.

Thousand-separator: Specified with "#.##". If no separator is allowed, use only "#" .

Decimal values and decimal places are set with 0 Example: "0" = no decimal, "0.00" = 2 decimal places.

 

e. g.  

English Windows Setup:

setvar=myvalue=3000.523
message=<myvalue,#,##0.000>               

// Output: 3,000.523
message=<myvalue,#0>                      

// Output: 3001
message=<myvalue,#0.0000>              

// Output: 3000.5230

 

German Windows-Setup:

setvar=myvalue=3000,523
message=<myvalue,#,##0.000>               

// Output: 3.000,523
message=<myvalue,#0>                         

// Output: 3001
message=<myvalue,#0.0000>              

// Output: 3000,5230
message=<myvalue,num(4)>                      

// Output: 3000.5230

 

For more information on format: see Table

 

Declared numeric variables

English and German settings

decimal lc_value1,lc_value2
lc_value1=5.55
lc_value2=<lc_value1,num(4)> * 4.34
setitem=columnvalue=<lc_value2,#0.0000>     
// columns: national format
messagebox=<lc_value1>                      
// Output 5.55
messagebox=<lc_value1,#0.0000>              
// Output english: 5.55 german 5,55
messagebox=<lc_value1,#0.000>         

 

Problem when calculating numeral values is that decimal places have to be calculated including the dot-separator. For this there is no formatting specification but a special command „num(value)"

 

<gutwert,num(3)>   
Output: 3400.000  (including the dot-separator)

Like this you can calculate:

 
setitem=my_field=%add(<goodvalue,num(3)>,<badvalue,num(3)>)

 

Only in this manner you can guarantee the correct formatting of decimal places.

 

The formatting is allowed to include placeholder specified with []

setvar=ls_myvalue=yellow,green,blue

setvar=ll_count=2

setvar=ls_tokenchar=,

messagebox=<ls_myvalue,token[ll_count] [ls_tokenchar]>

return: green

 

 

Table of Format

 

Character          Meaning

#                A number

0                A required number; a number will display for every 0 in the mask

 

[General]                        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;-$#,##0                        $5                -$5                $1

$#,##0;[RED]($#,##0)                $5                ($5)                $1

$#,##0.00;($#,##0.00)                $5.00                ($5.00)                $0.50

$#,##0.00;[RED]($#,##0.00)        $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

 

for convert in sql-statements:

 

num(x)                        x=decimal place

 

Example                        English                        German

message=<5.1234,#0.0>        5.1                        5,1

message=<5.1234,num(1)        5.1                        5.1