cancel
Showing results for 
Search instead for 
Did you mean: 

SDK: How to get total rows for matrix

former_member272979
Participant
0 Kudos

Hi,

I’m currently using the SDK to read line items from SO. I add a button for an event I want to happen. Below is sample code. The problem I’m having when I call the RowCount method, it always gives me one even though the matrix haves more than one row. Do you know what I need to revise to have it return the correct number of rows?

            If pVal.FormType = "139" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And pVal.ItemUID = "btnPO" And pVal.BeforeAction = True Then
                Try
                    Dim oSOForm As SAPbouiCOM.Form
                    Dim oMatrix As SAPbouiCOM.Matrix
                    oSOForm = SBO_Application.Forms.Item(FormUID)
                    oMatrix = oSOForm.Items.Item(38).Specific
                    MsgBox("Total Rows:" + oMatrix.RowCount.ToString)

                Catch ex As Exception
                    MsgBox(ex.Message)
                End Try
            End If

Regards,

William

Accepted Solutions (1)

Accepted Solutions (1)

former_member185682
Active Contributor

Hi William

There is a small mistake in your code in this line:

oMatrix = oSOForm.Items.Item(38).Specific

The correct is:

oMatrix = oSOForm.Items.Item("38").Specific

When you work with the items of the form you can retrieve them by two ways, by index or by Uid. In your case 38 is the Uid of the control that you want, then you need provide it as string.

Hope it clears.

Kind Regards,

Diego Lother

former_member272979
Participant
0 Kudos

Thanks your suggestion worked.

Answers (0)