I’m looking to update a custom field on the ShipDtl table that is used for on-time delivery tracking. I have this working on the ShipHead table with another field, but that affects all lines when I use it. It’s great when the entire pack is considered late incorrectly, but when there’s multiple lines and only 1 of them needs to have its on-time status reversed, that doesn’t work out very well. I’ve applied the same logic for the new ShipDtl field, OTDlineSwap_c, but get an error when trying to use it.
If I click yes, I get this:
Here’s the control field on the Lines tab in Customer Shipment Entry:
I get the native control references at the beginning of my code, I used the event wizard to add the functions. All is fine for my field on ShipHead, the issue is the field on ShipDtl.
I’m using the EpiDataViews and coding the field updates instead of using EpiBindings so I can use these fields if the pack is closed or not.
private void edvShipDtl_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
{
// ** Argument Properties and Uses **
// view.dataView[args.Row]["FieldName"]
// args.Row, args.Column, args.Sender, args.NotifyType
// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
if ((args.NotifyType == EpiTransaction.NotifyType.Initialize))
{
if ((args.Row > -1))
{
if(view.dataView[view.Row]["OTDlineSwap_c"].ToString() == "True" )
{
cbotdline.Checked = true;
}
else
{
cbotdline.Checked = false;
}
}
}
private void cbotdline_CheckedChanged(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
if(cbotdline.Checked == false)
{
EpiDataView view = (EpiDataView)(oTrans.EpiDataViews["ShipDtl"]);
view.dataView[view.Row].BeginEdit();
view.dataView[view.Row]["OTDlineSwap_c"] = 0;
view.dataView[view.Row].EndEdit();
}
if(cbotdline.Checked == true)
{
EpiDataView view = (EpiDataView)(oTrans.EpiDataViews["ShipDtl"]);
view.dataView[view.Row].BeginEdit();
view.dataView[view.Row]["OTDlineSwap_c"] = 1;
view.dataView[view.Row].EndEdit();
}
}
I’m doing essentially the same thing for the field on ShipHead, and it works. Here’s the code for that:
private void edvShipHead_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
{
// ** Argument Properties and Uses **
// view.dataView[args.Row]["FieldName"]
// args.Row, args.Column, args.Sender, args.NotifyType
// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
if ((args.NotifyType == EpiTransaction.NotifyType.Initialize))
{
if ((args.Row > -1))
{
if(view.dataView[view.Row]["OTDswap_c"].ToString() == "True" )
{
cbontime.Checked = true;
}
else
{
cbontime.Checked = false;
}
}
}
}
private void cbontime_CheckedChanged(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
if(cbontime.Checked == false)
{
EpiDataView view = (EpiDataView)(oTrans.EpiDataViews["ShipHead"]);
view.dataView[view.Row].BeginEdit();
view.dataView[view.Row]["OTDswap_c"] = 0;
view.dataView[view.Row].EndEdit();
}
if(cbontime.Checked == true)
{
EpiDataView view = (EpiDataView)(oTrans.EpiDataViews["ShipHead"]);
view.dataView[view.Row].BeginEdit();
view.dataView[view.Row]["OTDswap_c"] = 1;
view.dataView[view.Row].EndEdit();
}
}
Is what I’m trying to accomplish even possible?
Appreciate any help or advice!