Delete Order Misc Charges row in UI Customization

Hi Experts,

I tried searching epiusers for “how to delete rows from DataView” and did not find anything.

I am trying to delete Order Misc Charges (OHOrderMsc) in Order Entry UI Customization. I have tried below code in various formats and nothing worked. I have also tried setting RowMod to “D”, but no luck.

private void DeleteFRGT()
{
bool updt= false;
EpiDataView edvOHMisc= (EpiDataView)oTrans.EpiDataViews[“OHOrderMsc”];
foreach(DataRow dr in edvOHMisc.dataView.Table.Rows)
{
if(dr[“MiscCode”].ToString() == “FRT”)
{
dr.Delete();
updt= true;
}
}

if(updt == true)	{
	oTrans.Update();
	oTrans.Refresh();
}

}

Also tried below:

DataRow rows = edvOHMisc.dataView.Table.Select();

for(int i = 0; i < rows.Length ; i++)
{
edvOHMisc.dataView.Table.Rows[i].BeginEdit();
edvOHMisc.dataView.Table.Rows[i][“RowMod”] = “D”;
edvOHMisc.dataView.Table.Rows[i].EndEdit();

updt= true;
}

Reaching out to the community for help.

Thanks, SK.

Do a search for

Begin. Edit()

Thank you @Hally for the suggestion. I have solved the issue by using Method directives.

  1. Pre-Process: delete Db.OrderMsc for matching records within separate TransactionScope.
  2. Post-Process: Used SalesOrder.GetNewOHOrderMsc to add new rows for Misc freight charges.

Yes definitely a futureproof method… Limiting customisations on classic screens will put you in good stead for a Kinetic UI upgrade.

1 Like