cancel
Showing results for 
Search instead for 
Did you mean: 

Date column in matrix ....

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

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

Former Member
0 Kudos

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 !!!

Former Member
0 Kudos

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

Former Member
0 Kudos

Thanks everybody, It done.

Answers (0)