SAP B1 : Read from Matrix
19,334
Solution 1
@Miguel try this code
string ColId = "1"; //Set The Column Name to read
Int32 Row = 2; //Set the Row to Read
Matrix oMatrix =(Matrix)SBO_Application.Forms.ActiveForm.Items.Item("38").Specific; //Get Access to the Matrix
EditText oEdit =(EditText)oMatrix.Columns.Item(ColId).Cells.Item(Row).Specific; //Cast the Cell of the matrix to the respective type , in this case EditText
string sValue = oEdit.Value; //Get the value form the EditText
Miguel additionally check the SAP Business One SDK Forum for any question about SAP B1.
Solution 2
If you need to get data from Matrix :
var cellValue = oMatrix.Columns.Item(Column's Id or Index).Cells.Item(Row's Index).Specific.Value;
But if you need to update matrix value have to cast col to EditText obj like :
var oEdit = (SAPbouiCOM.EditText)oMatrix.Columns.Item(Column's Id or Index).Cells.Item(Row's Index).Specific;
oEdit.Value = "1";
![Admin](/assets/logo_square_200-5d0d61d6853298bd2a4fe063103715b4daf2819fc21225efa21dfb93e61952ea.png)
Author by
Admin
Updated on June 04, 2022Comments
-
Admin about 2 years
I'm trying to read from a Matrix. The code that I have until now is:
SAPbouiCOM.Matrix matrix = (SAPbouiCOM.Matrix SBO_Application.Forms.ActiveForm.Items.Item("38").Specific; SAPbouiCOM.Column col = matrix.Columns.Item("1") ; SAPbouiCOM.Cells cells = col.Cells; String cell = cells.Item(2).Specific.ToString(); String f = cell.ToString();
None of the Strings (cell and f) give me the value of the cell...
Any Idea?