on 2020 Jul 07 11:47 AM
HI all,
Im trying to set the value of a particular rows userdatasource bound matrix column value. But it seems like all the rows value gets changed. Please assist.
private void OnCustomInitialize()
{
//GET THE USER DATA SOURCE
Uds = this.UIAPIRawForm.DataSources.UserDataSources;
//ADD new datasource
Uds.Add("MX_DESC", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 100);
//BIND Matrix COLUMN
this.mtxContents.Columns.Item("colItmName").DataBind.SetBound(true, "", "MX_DESC");
this.mtxContents.Columns.Item("colItmName").ChooseFromListUID = "cflOITM2";
this.mtxContents.Columns.Item("colItmName").ChooseFromListAlias = "ItemName";
}
//SET VALUE IN THE EVENT
private void MtxContents_ChooseFromListAfter(object sboObject, SBOItemEventArg pVal)
{
Matrix mat = null;
if (pVal.ActionSuccess)
{
SBOChooseFromListEventArg oCFLEvento = (SBOChooseFromListEventArg)pVal;
var dataTable = oCFLEvento.SelectedObjects;
var itemName = dataTable.GetValue("ItemName", 0).ToString();
mat = this.mtxContents;
mat.GetLineData(pVal.Row);
Uds.Item("MX_DESC").ValueEx = itemName;
mat.SetLineData(pVal.Row);
}
}
Request clarification before answering.
When you add new row at matrix, you should clear data of row.
private void Button0_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
{
BubbleEvent = true;
Matrix0.AddRow();
//Clear new row data
Matrix0.ClearRowData(Matrix0.RowCount);
}
private void Matrix0_ChooseFromListAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
{
try
{
if (pVal.ActionSuccess)
{
SAPbouiCOM.SBOChooseFromListEventArg cfl = ((SAPbouiCOM.SBOChooseFromListEventArg)(pVal));
if (cfl.SelectedObjects == null)
{
return;
}
else
{
Matrix0.GetLineData(pVal.Row);
this.UIAPIRawForm.DataSources.UserDataSources.Item("UD_0").Value = cfl.SelectedObjects.GetValue("ItemCode", 0).ToString();
this.UIAPIRawForm.DataSources.UserDataSources.Item("UD_1").Value = cfl.SelectedObjects.GetValue("ItemName", 0).ToString();
Matrix0.SetLineData(pVal.Row);
}
}
}
catch (Exception e)
{
Application.SBO_Application.SetStatusBarMessage(e.Message,SAPbouiCOM.BoMessageTime.bmt_Short);
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks.
We have DB datasource, so only adding row to matrix and clearing it doesnt work.
The following looks ok
Uds.Item("ItemName").ValueEx = ""; // userdatasource
Dbds_ACQ1.Clear(); // db datasource
this.mtxContents.AddRow(1); // add row
this.mtxContents.FlushToDataSource(); // flush current matrix data back to datasource
| User | Count |
|---|---|
| 29 | |
| 15 | |
| 14 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.