cancel
Showing results for 
Search instead for 
Did you mean: 

Matrix problem

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I changed to:

oMatrix.AddRow(1)

oMatrix.GetLineData(1)

oDataSource1.Value = "AAAAAAAAAAAA"

oDataSource2.Value = "BBBBBBBBBBBB"

oMatrix.SetLineData(1)

it works fine.

thank you

Former Member
0 Kudos

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

former_member201110
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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"