on ‎2008 May 15 9:40 PM
Hello Experts
I am trying to enter a journal entry using the DI throught the system form of Goods Issue.
I have all the data, and everything works fine, however the problem is with convertion of the document total (which it does not exist as a field in the System Form of goods Issue (OIGE)) from string to double.
I have the following amount 3.000,00 EUR and I want to convert it to 3000,00
I have done my research in the forum and I came up with the following URL:
However I tried all the posible ways I can think along with those posted from the Above link
But nothing..... :'(
here is a preview of my code....
-
Dim omtx As SAPbouiCOM.Matrix
Dim oCol As SAPbouiCOM.Column
Dim ocolNum As SAPbouiCOM.EditText
Dim oTotalValue As String
Dim Value As Double
omtx = oform.Items.Item("13").Specific
oCol = omtx.Columns.Item("14")
Dim i As Integer
For i = 1 To omtx.RowCount
ocolNum = oCol.Cells.Item(i).Specific
oTotalValue += ocolNum.Value
Value = System.Convert.ToDouble(oTotalValue.Split(" ")(0).Replace(".", ""))
Next
-
the results are wrong and they depend on the format:
a) If I choose the Value to have a decimal format --> the result is 30000D
b) If I choose the Value to have the double format-->the result is 3.0
None of the above can (obviously) be accepted...:'''(
If Anyone can help me.....Please it's Important
Kind Regards
William McCulligh
Request clarification before answering.
Hi William,
iam using my own c# convert function.
in this sampe i set a default separator and currency, in my addons iam setting it when the addon starts with the correct values from database.
public static string SBODecSep = ",";
public static string SBOThousSep = ".";
public static string SBOMainCurncy = "EUR";
public static string SysDecSep = ",";
public static decimal StrToDec(string Text)
{
Text = Text.Replace(SBOMainCurncy, "").Trim();
Text = Text.Replace(SBOThousSep, "");
Text = Text.Replace(SBODecSep, SysDecSep);
if (Text == "")
{
Text = "0";
}
return Convert.ToDecimal(Text);
}
this function returns a decimal - change it to double if you want.
i hope it helps you.
EDIT:
i forgot to mention (it was too late yesterday)
SysDecSep = Windows Setting
SBOxxx = Business One Setting
much luck
David
Edited by: David Nussböck on May 16, 2008 10:01 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David
Your code was exactly what I wanted!!
Thanks a lot
Kind Regards
William
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The problem should be with regional settings. I think that easiest way for you is use something like
value = "1.235 EUR"
dim x as double
x = cdbl(replace(replace(left(x, instr(x, " ") - 1), ",", ""), "."))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 46 | |
| 27 | |
| 17 | |
| 6 | |
| 3 | |
| 3 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.