on 04-12-2006 5:39 AM
Hi my gurus,
I design form by Screen Painter with a matrix, I want to load DocNum, DocDate, ... of ORDR table into matrix, but it error: "Invalid date value". Pls tell me how to do it. Thanks for everything.
Hi Andy,
If you bind the date column with a DBDataSource to a date column in a database, it shouldn't be a problem.
If you use UserDataSources (or by setting edittext values) you should put the date in a string, in this format: "yyyymmdd".
If you run into any problem, please provide us with your code. Then we could look what is wrong, now we are just guessing what you mean...
Hope it helps,
Rowdy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks R. Schwachofer,
This is my code, Pls help me !!!
oDBDataSource = oForm.DataSources.DBDataSources.Add("ORDR")
colSO = oColumns.Item("col_SO")
colSO.DataBind.SetBound(True, "ORDR", "DocNum")
colPostDate = oColumns.Item("col_PostDa")
colPostDate.DataBind.SetBound(True, "ORDR", "DocDate")
colCurr = oColumns.Item("col_Curr")
colCurr.DataBind.SetBound(True, "ORDR", "DocCur")
colAmount = oColumns.Item("col_Amount")
colAmount.DataBind.SetBound(True, "ORDR", "DocTotal")
str = "Select DocNum,DocDate,DocCur,DocTotal from ORDR where " 'DocAtatus = 'O'
str = str & " (CardCode = '" & cmbCustCode.Selected.Value & "')"
str = str & " AND (DocDate BETWEEN '" & txtFrDate.Value & "' AND '" & txtToDate.Value & "')"
oRS.DoQuery(str)
oMatrix.AddRow()
oRS.MoveFirst()
Try
While Not oRS.EoF
oEdit = colSO.Cells.Item(oMatrix.RowCount).Specific
oEdit.Value = oRS.Fields.Item("DocNum").Value
oEdit = colCurr.Cells.Item(oMatrix.RowCount).Specific
oEdit.Value = oRS.Fields.Item("DocCur").Value
oEdit = colPostDate.Cells.Item(oMatrix.RowCount).Specific
oEdit.Value = oRS.Fields.Item("DocDate").Value
oEdit = colAmount.Cells.Item(oMatrix.RowCount).Specific
oEdit.Value = oRS.Fields.Item("DocTotal").Value
oMatrix.AddRow()
oRS.MoveNext()
End While
Catch ex As Exception
SBO_Application.MessageBox(ex.ToString)
End Try
I also use LoadFromDataSource method, but it can't to get data,(I think it error on conditions for DocDate) this my code :
oConditions = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_Conditions)
Try
oCondition = oConditions.Add
oCondition.BracketOpenNum = 2
oCondition.Alias = "CardCode"
oCondition.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
oCondition.CondVal = cmbCustCode.Selected.Value
oCondition.BracketCloseNum = 1
oCondition.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND
oCondition = oConditions.Add
oCondition.BracketOpenNum = 1
oCondition.Alias = "DocDate"
oCondition.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
oCondition.CondVal = <b>txtFrDate.Value</b>
oCondition.CondEndVal = <b>txtToDate.Value</b>
oCondition.BracketCloseNum = 2
oDBDataSource.Query(oConditions)
oMatrix.LoadFromDataSource()
Thanks for your help !!!
Hi Andy
In the first code snippet where u loop through a recorset object & fill in ur values
oEdit = colPostDate.Cells.Item oMatrix.RowCount).Specific
oEdit.Value = oRS.Fields.Item("DocDate").Value
Try using a datetime object where u store the the returned DocDate & then assign the value of this object to the matrix
eg
Dim tmpDate as Datetime
tmpdate = oRS.Fields.Item("DocDate").Value
oEdit = colPostDate.Cells.Item oMatrix.RowCount).Specific
oEdit.Value = = tmpDate.toString("yyyyMMdd")
The error that u get is mainly because the return type of recordset is "Date" whereas oEdit.Value is string
User | Count |
---|---|
108 | |
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.