Does anyone know how to call a Stored Procedure from Epicor Cust

The array index issue, remember that C# starts at zero not one, so your
for(int i = 0; i <= edvRcvDtlMassReceipt.dataView.Count; i++)
Should be just < (less than), if an array has 10 items, the member be 0 - 9, not 0 - 10 which your code will attempt to do
for(int i = 0; i < edvRcvDtlMassReceipt.dataView.Count; i++)

There are a lot of other things to consider in what you are trying to do.  Looping through the items may or may not be needed but if it is there are some simple C# techniques that will make it a lot cleaner.  For example maybe a ForEach on the datarows, this automatically will only loop through the members of the data without needing to track the count.

Getting a bit more familiar with working with Epicor Objects I think you will find rarely if ever would you need to break out using a direct all to SQL.
Jim Kinneman
Encompass Solutions, Inc.
Does anyone know how to call a Stored Procedure from Epicor Customization? I am trying to update the Epicor SQL Table RcvDtl.

It sounds like a good way to void your warranty.

 

It’s really simply to do, but I wouldn’t recommend it.

 

What specifically are you attempting to do? Perhaps we can suggest an alternate approach.

 

Tom Christie |  Information Technology Manager  |  AGM Container Controls, Inc.  |   tchristie@...  | t: 520.881.2130 ext 2176

 

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of cyrilz199@...
Sent: Friday, February 21, 2014 11:06 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Does anyone know how to call a Stored Procedure from Epicor Customization.

 

 

Does anyone know how to call a Stored Procedure from Epicor Customization? I am trying to update the Epicor SQL Table RcvDtl.

I am trying to update the RcvDtl WareHouseCode from the table PORel  when the ReceivedTo equals 'PUR-UKN'.

I wrote code via customization using c# calling some adapter using BO's and it is hell of slow. Also, when I loop through the grid edvMassReceipt, I get array out of index exceptions some times.

 

I am looking at doing this with a BPM now, aslo I may be on the wrong event via code. I am still learnig the events to fire when using customizations.

Below is my code.

 

private void edvRcvDtlMassReceipt_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.AddRow))

{

if ((args.Row > -1))

{

for(int i = 0; i <= edvRcvDtlMassReceipt.dataView.Count; i++)

{

if(edvRcvDtlMassReceipt.dataView[i]["ReceivedTo"].ToString() == "PUR-UKN")

{

if(edvRcvDtlMassReceipt.dataView[i]["WareHouseCode"].ToString() == string.Empty )

{

//string WareHouseCodeAndDescription = getWareHouseFromPO(((int)e.Row.Cells["PONum"].Value));

string WareHouseCodeAndDescription = getWareHouseFromPO(int.Parse(edvRcvDtlMassReceipt.dataView[i]["PONum"].ToString()));

string[] WareHouse = WareHouseCodeAndDescription.Split('_');

if(string.IsNullOrEmpty(WareHouseCodeAndDescription))

{

edvRcvDtlMassReceipt.dataView[i].BeginEdit();

edvRcvDtlMassReceipt.dataView[i]["WareHouseCode"] = "NS";

edvRcvDtlMassReceipt.dataView[i]["WareHouseCodeDescription"] = "NONSTOCK";

edvRcvDtlMassReceipt.dataView[i]["BinNum"] = "1";

edvRcvDtlMassReceipt.dataView[i].EndEdit();

}

else

{

edvRcvDtlMassReceipt.dataView[i].BeginEdit();

edvRcvDtlMassReceipt.dataView[i]["WareHouseCode"] = WareHouse[0];

edvRcvDtlMassReceipt.dataView[i]["WareHouseCodeDescription"] = WareHouse[1];

edvRcvDtlMassReceipt.dataView[i]["BinNum"] = getBinNum(edvRcvDtlMassReceipt.dataView[i]["PartNum"].ToString(),WareHouse[0]);

edvRcvDtlMassReceipt.dataView[i].EndEdit();

}

}

}

}

 

}

}

}