Read Matrix Columns Records using SerializeAsXML
Lakshmi Narayanan
SAP Business One Tech Consultant | ?? Freelancer | ?? Trainer | ?? Team Leader | ?? Project Manager | ?? Developer | ???? Mentor | ?? New Learner #SAP #TechConsultant #Freelancer
Code is below
Friend Function GetMatrixMultipleValue(ByRef oForm As SAPbouiCOM.Form, ByVal oMatrixUID As String, ByVal strEleID() As Object, ByVal inrRow As Integer) As Object()
Dim strRetValue(strEleID.Length - 1) As Object
Try
Dim oMatrix As SAPbouiCOM.Matrix = oForm.Items.Item(oMatrixUID).Specific
Dim strMatrixXML As String = oMatrix.SerializeAsXML(BoMatrixXmlSelect.mxs_All)
Dim xDoc = XDocument.Parse(strMatrixXML)
Dim strXMLmatrixRows = xDoc.Descendants("Rows")
Dim intXMLRowsCount As Integer = strXMLmatrixRows.Count
If intXMLRowsCount > 0 Then
For ColIndex As Integer = 0 To strEleID.Length - 1
Dim strColName As String = strEleID(ColIndex)
Dim strStkStatus = From s In strXMLmatrixRows.Descendants("Column") Where s.Element("ID").Value = strColName Select s.Element("Value").Value
strRetValue(ColIndex) = strStkStatus.ElementAt(inrRow)
Next
End If
Catch ex As Exception
strRetValue = Nothing
End Try
Return strRetValue
End Function
#MatrixColumns #SerializeAsXML #ReadRecords #DataSerialization #XML #DataManagement #Coding #Programming #LinkedIn #EnglishLanguage