Delete UD Table Records From Configurator E10

Hey, that works. In other applications I've deleted them first. That's Just The Way You Do Things. :-)

I thought about writing an "END" record, but this is cleaner.

Thanks,

Joe

On Fri, Jul 24, 2015 at 11:41 AM, brenda mohr brenda@... [vantage] <vantage@yahoogroups.com> wrote:

Â
<div>
  
  
  <p>

Is there a reason you want them deleted? Instead of deleting, I tend to mark the row as no longer used via a checkbox and then just add checkbox == false. You can also zero/blank them out and/or overwrite them. I just think it is a bit safer.

Â

Brenda

Â

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Friday, July 24, 2015 12:16 PM
To: vantage@yahoogroups.com
Subject: [Vantage] Delete UD Table Records From Configurator E10

Â

Â

Hi,

I'm writing out data from our configurators to be used when printing quotes and orders. Someone shared some nifty code to let me write my list to a UD table.

This is in a UD Method that will fire from the configurator on save event:

string ItemOrderKey = ItemOrder.ToString("000000");

using (var txScope = Erp.ErpContext.CreateDefaultTransactionScope()){Â Â Â var UD40 = (from row in Epicor.Data.WithExtension.With(Db.UD40, Epicor.Data.LockHint.UpdLock)Â Â Â Â where row.Company == Context.CompanyID && row.Key1 == InputName && row.Key2 == ItemOrderKey select row).FirstOrDefault();


   if (UD40 == null)   {     UD40 = new Ice.Tables.UD40();     Ice.IceDataContextExtensions.Insert(Db.UD40, UD40);     UD40.Company = Context.CompanyID;     UD40.Key1 = InputName;     UD40.Key1 = ItemOrderKey;   }   UD40.Character01 = ItemDescription;   UD40.Character02 = Character02;   UD40.Number01 = Number01;      Db.Validate();

Â

What I need before this runs is to delete any rows existing from a prior configuration save.

Direction? Share some code?

Thanks,

JoeÂ

--

Joe D. Trent

Bigham Ag Equipment

Â

</div>
 


<div style="color:#fff;min-height:0;"></div>

Hi,

I'm writing out data from our configurators to be used when printing quotes and orders. Someone shared some nifty code to let me write my list to a UD table.

This is in a UD Method that will fire from the configurator on save event:

string ItemOrderKey = ItemOrder.ToString("000000");

using (var txScope = Erp.ErpContext.CreateDefaultTransactionScope()){     var UD40 = (from row in Epicor.Data.WithExtension.With(Db.UD40, Epicor.Data.LockHint.UpdLock)       where row.Company == Context.CompanyID && row.Key1 == InputName && row.Key2 == ItemOrderKey select row).FirstOrDefault();


     if (UD40 == null)     {          UD40 = new Ice.Tables.UD40();          Ice.IceDataContextExtensions.Insert(Db.UD40, UD40);          UD40.Company = Context.CompanyID;          UD40.Key1 = InputName;          UD40.Key1 = ItemOrderKey;     }     UD40.Character01 = ItemDescription;     UD40.Character02 = Character02;     UD40.Number01 = Number01;          Db.Validate();


What I need before this runs is to delete any rows existing from a prior configuration save.

Direction? Share some code?

Thanks,

Joe 

--

Joe D. Trent

Bigham Ag Equipment


Is there a reason you want them deleted?  Instead of deleting, I tend to mark the row as no longer used via a checkbox and then just add checkbox == false.  You can also zero/blank them out and/or overwrite them.  I just think it is a bit safer.

 

Brenda

 

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Friday, July 24, 2015 12:16 PM
To: vantage@yahoogroups.com
Subject: [Vantage] Delete UD Table Records From Configurator E10

 

 

Hi,

I'm writing out data from our configurators to be used when printing quotes and orders. Someone shared some nifty code to let me write my list to a UD table.

This is in a UD Method that will fire from the configurator on save event:

string ItemOrderKey = ItemOrder.ToString("000000");

using (var txScope = Erp.ErpContext.CreateDefaultTransactionScope()){     var UD40 = (from row in Epicor.Data.WithExtension.With(Db.UD40, Epicor.Data.LockHint.UpdLock)       where row.Company == Context.CompanyID && row.Key1 == InputName && row.Key2 == ItemOrderKey select row).FirstOrDefault();


     if (UD40 == null)     {          UD40 = new Ice.Tables.UD40();          Ice.IceDataContextExtensions.Insert(Db.UD40, UD40);          UD40.Company = Context.CompanyID;          UD40.Key1 = InputName;          UD40.Key1 = ItemOrderKey;     }     UD40.Character01 = ItemDescription;     UD40.Character02 = Character02;     UD40.Number01 = Number01;          Db.Validate();

 

What I need before this runs is to delete any rows existing from a prior configuration save.

Direction? Share some code?

Thanks,

Joe 

--

Joe D. Trent

Bigham Ag Equipment