Skip to Content
avatar image
Former Member

Matrix problem

I wrote a simple Matrix with only 1 row for testing,

here is the code:

oColumn = oColumns.Add("CardCode", SAPbouiCOM.BoFormItemTypes.it_EDIT)

oColumn.TitleObject.Caption = "Vendor"

oColumn.Width = 80

oColumn = oColumns.Add("CardName", SAPbouiCOM.BoFormItemTypes.it_EDIT)

oColumn.TitleObject.Caption = "Name"

oColumn.Width = 100

oMatrix.AddRow(1)

oMatrix.Columns.Item("CardCode").Cells.Item(1).Specific.Value = "AAAAAAAAAA"

oMatrix.Columns.Item("CardName").Cells.Item(1).Specific.value = "BBBBBBBBBB"

The matrix frame is displayed fine, but the content "AAAAAAAAA" and "BBBBBBBBBB" can't be displayed.

Thanks

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Sep 23, 2008 at 05:05 AM

    instead of filling value set .string to

    oColumn = oColumns.Add("CardCode", SAPbouiCOM.BoFormItemTypes.it_EDIT)
    oColumn.TitleObject.Caption = "Vendor"
    oColumn.Width = 80
    oColumn = oColumns.Add("CardName", SAPbouiCOM.BoFormItemTypes.it_EDIT)
    oColumn.TitleObject.Caption = "Name"
    oColumn.Width = 100
    oMatrix.AddRow(1)
    Dim edt As SAPbouiCOM.EditText
    edt = oMatrix.Columns.Item("CardCode").Cells.Item(1).Specific
    edt.String= "AAAAAAAAAA"
    edt = oMatrix.Columns.Item("CardName").Cells.Item(1).Specific
    edt.String = "BBBBBBBBBB"

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 23, 2008 at 05:13 AM

    Thanks for your reply.

    but the problem stills.

    here is the whole parts, please help to check is there something missing.

    Private oForm As SAPbouiCOM.Form

    Private oItem As SAPbouiCOM.Item

    Dim oColumn As SAPbouiCOM.Column

    Dim oColumns As SAPbouiCOM.Columns

    Dim oMatrix As SAPbouiCOM.Matrix

    oForm = SBO_Application.Forms.Add("TEST", SAPbouiCOM.BoFormTypes.ft_Fixed)

    oItem = oForm.Items.Add("matrix", SAPbouiCOM.BoFormItemTypes.it_MATRIX)

    oItem.Top = 110

    oItem.Left = 10

    oItem.Width = 670

    oItem.Height = 250

    oMatrix = oItem.Specific

    oColumns = oMatrix.Columns

    oColumn = oColumns.Add("CardCode", SAPbouiCOM.BoFormItemTypes.it_EDIT)

    oColumn.TitleObject.Caption = "Vendor"

    oColumn.Width = 80

    oColumn = oColumns.Add("CardName", SAPbouiCOM.BoFormItemTypes.it_EDIT)

    oColumn.TitleObject.Caption = "Name"

    oColumn.Width = 100

    oMatrix.AddRow(1)

    Dim edt As SAPbouiCOM.EditText

    edt = oMatrix.Columns.Item("CardCode").Cells.Item(1).Specific

    edt.String = "AAAAAAAAAA"

    edt = oMatrix.Columns.Item("CardName").Cells.Item(1).Specific

    edt.String = "BBBBBBBBBB"

    Thanks

    Add comment
    10|10000 characters needed characters exceeded

    • Hi,

      When populating a matrix on a user form, you should use datasources to populate the cells rather than setting the value directly in the control.

      Create two userdatasources:

      Dim oDataSource1 as SAPbouiCOM.UserDataSource = oForm.DataSources.UserDataSources.Add("CardCode", SAPbouiCOM.BoFormItemTypes.it_EDIT)
      Dim oDataSource2 as SAPbouiCOM.UserDataSource = oForm.DataSources.UserDataSources.Add("CardName", SAPbouiCOM.BoFormItemTypes.it_EDIT)
      

      Then bind the datasources to the columns:

      oColumn = oColumns.Add("CardCode", SAPbouiCOM.BoFormItemTypes.it_EDIT)
      oColumn.TitleObject.Caption = "Vendor"
      oColumn.DataBind.SetBound(True, "", "CardCode")
      oColumn.Width = 80
      oColumn = oColumns.Add("CardName", SAPbouiCOM.BoFormItemTypes.it_EDIT)
      oColumn.TitleObject.Caption = "Name"
      oColumn.DataBind.SetBound(True, "", "CardName")
      oColumn.Width = 100
      

      Finally, use the following code to populate the matrix:

      oMatrix.AddRow(1)
      oMatrix.GetCurrentLine(0)
      oDataSource1.ValueEx = "AAAAAAAAAAAA"
      oDataSource2.ValueEx = "BBBBBBBBBBBB"
      oMatrix.SetCurrentLine(0)
      

      Kind Regards,

      Owen

  • avatar image
    Former Member
    Sep 24, 2008 at 02:13 AM

    I changed to:

    oMatrix.AddRow(1)

    oMatrix.GetLineData(1)

    oDataSource1.Value = "AAAAAAAAAAAA"

    oDataSource2.Value = "BBBBBBBBBBBB"

    oMatrix.SetLineData(1)

    it works fine.

    thank you

    Add comment
    10|10000 characters needed characters exceeded