cancel
Showing results for 
Search instead for 
Did you mean: 

Find row Index of edited matrix cell

Former Member
0 Kudos

Hai,

I have designed a matrix which shows some value. The user is allowed to edit the values in Matrix cell. I want to update the edited value in no object table.Is there any way to find out the row indexes of edited cell of matrix.

If so, How to achieve this?

Thanks in Advance.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Create Temp table and store it.use validate event.

Regards,

Siva

Former Member
0 Kudos

If you catch the validate event as the user leaves the field, you can check pVal.Row. This gives you the visual row number of the line in the matrix.

This should get you started, but if it not the solution, can you please explain further what you mean by the row indexes & what exactly you are going to do with the value.

Former Member
0 Kudos

Hai,

Consider this values shown in matrix.

ManagerID EmployeeID Title

-


-


-


NULL 1 Chief Executive Officer

1 273 Vice President of Sales

273 16 Marketing Manager

273 274 North American Sales Manager

16 23 Marketing Specialist

274 275 Sales Representative

274 276 Sales Representative

285 286 Sales Representative

In case user edit Title field that particular edited value for particular employee should be updated in another No Object Table. Hope you get my query.

Can you explain how to used validate event?

Thanks in advance.

Former Member
0 Kudos

Using the validate is the same as any other itemevent: C:\Program Files\SAP\SAP Business One SDK\Samples\COM UI\CSharp\02.CatchingEvents

The event will be raised when a user exits a field but in this case I don't think it's what you need.

You should:

1. Put a button on your form,

2. when the user clicks it, loop through the matrix

3. Check the Titles, and if they are different to what is in the No Object UDT, do step 4

4. Update the table.

These are important SDK concepts and you should invest some time in learning how to use both the Matrix Object and the UserTables object. The SDK helpfile provides sample codes.

For example, the following method can be used to update a record in a UDT

Private Sub Add_Data_Click()
    Dim oUserTable As SAPbobsCOM.UserTable
    Set oUserTable = oCompany.UserTables.Item("NoObjectTableName")

    oUserTable.GetByKey ("CodeOfValueInNoObjectTable")

    'Set default, mandatory fields
    oUserTable.Name = "Title"
    'Set user field
    oUserTable.UserFields.Fields.Item("U_AdditionalUDF").Value = "1"

    ret = oUserTable.Update

    If ret <> 0 Then
        oCompany.GetLastError ret, Str
        MsgBox Str
    Else
        MsgBox "Value to field: '" & oUserTable.UserFields.Fields.Item("U_AlbUDF").Name & "' was updated successfuly to " & oUserTable.TableName & " Table"
    End If
End Sub

I do not have the time to write up a full routine for this, but this information should be enough to get you started. Also check the SDK samples C:\Program Files\SAP\SAP Business One SDK\Samples\COM UI\CSharp\06.UseMatrix

Edit: To answer your intial question, there is no indicator on the matrix object which shows which rows are edited - you have to implement a logic that checks this yourself.

e.g. you could use the validate event to store the row number (pVal.Row) in a List that you can then use later after the user clicks the button.