on 05-17-2006 3:56 PM
We are using LoadBatchActions to populate a matrix with data in a single call by passing an XML document, but we have noticed that in B1 2005, date columns in the matrix seem to parse the date wrong. When you have the date format set to DD/Month/YYYY then it expects a month name in the XML date value instead of the neutral YYYYMMDD format. I thought XML was supposed to be a language-neutral format, and that data passed to B1 was supposed to be in a language-neutral format. Is there an error here?
Hello Ben,
Have you checked your local setting of SAP Business One?
HTH,
Nick
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's the problem. Local settings should not affect data format at this level. I can work around it by changing the string according to the local settings, but data formats are supposed to be locale-agnostic.
The following code demonstrates the problem. This code should work no matter what the local settings are, but it fails when using DD/Month/YYYY format:
[code]
Sub CreateDateMatrix()
Dim frm As SAPbouiCOM.Form
Dim cp As SAPbouiCOM.FormCreationParams
Set cp = sboApp.CreateObject(cot_FormCreationParams)
cp.FormType = "FSE_TestDate"
cp.BorderStyle = fbs_Sizable
Set frm = sboApp.Forms.AddEx(cp)
frm.Visible = True
Dim mtxItem As SAPbouiCOM.Item
Set mtxItem = frm.Items.Add("Matrix", it_MATRIX)
mtxItem.Left = 10
mtxItem.Top = 10
mtxItem.Width = frm.ClientWidth - 20
mtxItem.Height = frm.ClientHeight - 20
Dim ds As SAPbouiCOM.UserDataSource
Set ds = frm.DataSources.UserDataSources.Add("DateDS", dt_DATE)
Dim mtx As SAPbouiCOM.Matrix
Set mtx = mtxItem.Specific
mtx.Columns.Add("RowMark", it_EDIT).Editable = False
With mtx.Columns.Add("Date", it_EDIT)
.Editable = -False
.DataBind.SetBound True, , "DateDS"
.Width = 100
.TitleObject.Caption = "Date"
End With
Dim populate As String
populate = "<Application><forms><action type=""update"">" & _
"<form uid=""" & frm.UniqueID & """>"
populate = populate & "<items><action type=""update"">" & _
"<Item uid=""Matrix"">"
populate = populate & "<Specific><rows><action type=""add"">"
Const rowCount As Integer = 5
Dim i As Integer
For i = 1 To rowCount
populate = populate & "<row index=""" & CStr(i) & """ />"
Next
populate = populate & "</action><action type=""update"">"
Dim dateString As String
For i = 1 To rowCount
dateString = Format$(Now + i, "yyyyMMdd")
populate = populate & "<row index=""" & CStr(i) & """>" & _
"<column uid=""Date"" string=""" & dateString & """ /></row>"
Next
populate = populate & "</action></rows></Specific></Item></action>" & _
"</items></form></action></forms></Application>"
sboApp.LoadBatchActions populate
MsgBox sboApp.GetLastBatchResults
End Sub
[/code]
User | Count |
---|---|
103 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.