SAP B1:从矩阵读取
问题描述:
我正在尝试从矩阵读取。 我有到现在为止的代码是:SAP B1:从矩阵读取
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();
弦乐的无(电池和f)给我的单元格的值...
任何想法?
答
@Miguel试试这个代码
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
米格尔还检查SAP Business One SDK Forum有关SAP B1任何问题。
答
SAPbouiCOM.EditText EditValue;
string strValue;
String ColUId = "col_1" // Column UID
Int32 Row = 1 //Row Number
Item item = form.Items.Item("38");
Matrix matrix = ((Matrix)(item.Specific));
EditValue = (SAPbouiCOM.EditText)matrix.GetCellSpecific(ColUId, Row);
strValue = EditValue.Value.ToString().Trim();
答
我们也可以按照以下方式编写。我在vb.net中做了这个
Dim matrix as SAPbouiCOM.Matrix
matrix = oForm.Items.Item("38").Specific
dim f as string = matrix .Columns.Item("3").Cells.Item(2).Specific.value.tostring
这里的单元格号是2,列号是3。所以f值将是3列值的第2行。
答
如果您尝试从窗体读取某些列值,那么使用SQL查询会更容易。这就是我所做的。
string firmenname = "";
string ort = "";
string plz = "";
string strasse = "";
SAPbobsCOM.Recordset mRs1 = (SAPbobsCOM.Recordset)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
string sqlstring = " select top 1 street, zipcode, city, country, address from CRD1 where cardcode = '" + codeid + "' and adrestype ='B' ";
mRs1.DoQuery(sqlstring);
while (!mRs1.EoF)
{
strasse = mRs1.Fields.Item("street").Value.ToString();
ort = mRs1.Fields.Item("city").Value.ToString();
plz = mRs1.Fields.Item("zipcode").Value.ToString();
firmenname = mRs1.Fields.Item("address").Value.ToString();
mRs1.MoveNext();
}
我有点像你一样的问题。但是在我提出这个想法之后,很容易从具有列数的任何形式读取值。你所要做的就是“查看 - >系统信息”,并知道在哪个数据库表中存储值。然后编写你想要的SQL查询。
希望这可以帮助你!
答
如果您需要从矩阵得到的数据:
VAR cellValue = oMatrix.Columns.Item(栏的ID或指数).Cells.Item(行的索引).Specific.Value;
但是如果你需要更新矩阵值要投山坳到的EditText OBJ喜欢:
var oEdit = (SAPbouiCOM.EditText)oMatrix.Columns.Item(Column's Id or Index).Cells.Item(Row's Index).Specific;
oEdit.Value = "1";