on 2016 Apr 28 9:58 AM
Dear All,
How to Add Row Number in UDO Matrix? I am using below code.
'Declare Variables
Private WithEvents SBO_Application As SAPbouiCOM.Application
Private WithEvents oForm As SAPbouiCOM.Form = Nothing
Private WithEvents oItem As SAPbobsCOM.Items
Private WithEvents oMatrix As SAPbouiCOM.Matrix
Public Sub New()
SBO_Application = SAPbouiCOM.Framework.Application.SBO_Application
oForm = Me.UIAPIRawForm
oForm = SBO_Application.Forms.ActiveForm()
End Sub
Private Sub SBO_Application_ItemEvent(FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
Try
Select Case pVal.Before_Action
Case True
Select Case pVal.EventType
Case SAPbouiCOM.BoEventTypes.et_FORM_CLOSE
flag = 1
End Select
Case False
Select Case pVal.EventType
Case SAPbouiCOM.BoEventTypes.et_FORM_ACTIVATE
frmUid = pVal.FormUID
If flag = 0 Then
oForm = SBO_Application.Forms.ActiveForm()
oForm = DirectCast(SBO_Application.Forms.Item(frmUid), SAPbouiCOM.Form)
oItem = DirectCast(oApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems), SAPbobsCOM.Items)
'oForm.Freeze(True)
oMatrix = oForm.Items.Item("0_U_G").Specific
For index As Integer = 1 To oMatrix.VisualRowCount
oMatrix.Columns.Item("#").Cells.Item(index).Specific.Value = 1
oMatrix.Columns.Item("#").Editable = False
Next
'oForm.Freeze(False)
flag = 1
End If
End Select
End Select
Catch ex As Exception
Finally
End Try
End Sub
When Form Opened , The Row Number displayed. But when i clicked Header of Matrix , The Value was removed.
Hi Lakshmi,
Can you try this and let us know the results:
private void SetRowNumber()
{
SAPbouiCOM.Matrix oMatrix = (SAPbouiCOM.Matrix)m_SBO_Form.Items.Item("Matrix").Specific;
try
{
if (oMatrix.VisualRowCount > 0)
{
oMatrix.FlushToDataSource();
int count = _dBDataSourceChild.Size;
for (int i = 0; i <= count-1; i++)
{
this.m_SBO_Form.DataSources.DBDataSources.Item("@TableName").SetValue("U_LineNum", i, (i + 1).ToString());
}
oMatrix.LoadFromDataSource();
}
}
catch
{
throw;
}
}
Please change the code as per your need.
Kind regards,
ANKIT CHAUHAN
SAP Business One Global Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
104 | |
8 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.