I have the following situation:
I have an Excel File which should be the base for a SAP posting. So I have this field amount in Excel which is for example 100,550303.
In Germany we have our decimals with , and not with . (point). So I received the help from a colleague that I have to set up the CultureInfo to (de-DE) and so the . changed to a comma which is perfect.
But now I have the problem that I have to extend my settings that I can format to a double figure, but I am not really good in programming .
CDbl(100.550303)
100.550303
CDbl(100.550303).toString(“F2”)
“100.55”
CDbl(100.550303).toString(“F2”, New System.Globalization.CultureInfo(“de-DE”))
“100,55”
CDBl (or other conversion) will convert input to double
using a string as input it has to follow some specific formattings other wise we have to handle additional
Does mean in → double
when we want get back a different format we can specify it
Does mean double → string in needed format
And as you can see above with using the DE Globalization we got the comma as decimal seperator
so in your case jsut check on how the string is stored withinn the datatable and if it can be handled with CDbl
CDbl(CurrentRow("Field").toString.Trim).toString("F2", New System.Globalization.CultureInfo("de-DE")
we prefer to use these approaches instead of string manipulations as in unforseen scenarios the dot, comma replacements can harm without getting detected / throwing exceptions
Bug risk scenario:
the wrong intended change edits the value from 123456 and decimal part 23 to 123 mio 456 Ths And 23