Databasevalue To Number With 2 Decimals Follow

0
Avatar
Legacy Poster

Hello,

 

I have a databasevalue like 1.024,50764672563287 and I want conversion to 1.024,51

2 decimals after the comma.

 

How can I achieve this with vb-script?

 

I have tried several vb-scripts but not the right one. He always uses the first sepertor and set the value to 1,02

 

Thanks in advance.

 

Paul

 

 

2 comments

0
Avatar
Shotaro Ito
Comment actions Permalink

Is that German number? On the text's Transform > VB Script > OnProcessData, apply below

 

'Set locale to German-Germany'
Call SetLocale(1031)
If IsNumeric(Value) Then
  Value = FormatNumber(Value,2)
End If

On BT10.0 or later, there's number format with specific locale to take such format too.

0
Avatar
Legacy Poster
Comment actions Permalink

Thanks, i've got it working with below code:

 

Call SetLocale(1043)
If IsNumeric(Value) Then
    Value=Replace(Value,".","")
  Value = FormatNumber(Value,2)
End If

Please sign in to leave a comment.