I am adding two data views to an UD05 entry item. The test code function says that there is nothing wrong. However, when I close and reopen the UD05 entry screen with the customization active I get the following error:
I believe this error is caused by the line “InitializeUD05Adapter();” within the Initialize Custom Code block. The reason for this is that when I comment out that section of code everything seems to work as normal. I have included both the Initialize Custom Code block and the InitializeUD05Adapter block below.
As always thanks for the help!
public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
// Begin Wizard Added Variable Initialization
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Calls
// End Wizard Added Custom Method Calls
//eb1:
InitializeUD05Adapter();
this._Key1UD05 = string.Empty;
this._Key2UD05 = string.Empty;
this._Key3UD05 = string.Empty;
this._Key4UD05 = string.Empty;
this._Key5UD05 = string.Empty;
this._Key1UD05_2 = string.Empty;
this._Key2UD05_2 = string.Empty;
this._Key3UD05_2 = string.Empty;
this._Key4UD05_2 = string.Empty;
this._Key5UD05_2 = string.Empty;
}
private void InitializeUD05Adapter()
{
// Create an instance of the Adapter.
this._UD05Adapter = new UD05Adapter(this.oTrans);
this._UD05Adapter.BOConnect();
this._UD05Adapter_2 = new UD05Adapter(this.oTrans);
this._UD05Adapter_2.BOConnect();
// Add Adapter Table to List of Views
// This allows you to bind controls to the custom UD Table
this._edvUD05 = new EpiDataView();
this._edvUD05.dataView = new DataView(this._UD05Adapter.UD05Data.UD05);
this._edvUD05_2 = new EpiDataView();
this._edvUD05_2.dataView = new DataView(this._UD05Adapter_2.UD05Data.UD05);
//this._edvUD05.AddEnabled = true;
//this._edvUD05.AddText = "New UD05";
this._edvUD05.AddEnabled = false;
this._edvUD05_2.AddEnabled = false;
if ((this.oTrans.EpiDataViews.ContainsKey("UD05View") == false))
{
this.oTrans.Add("UD05View", this._edvUD05);
}
if ((this.oTrans.EpiDataViews.ContainsKey("UD05View_2") == false))
{
this.oTrans.Add("UD05View_2", this._edvUD05_2);
}
// Initialize DataTable variable
this.UD05_Column = this._UD05Adapter.UD05Data.UD05;
this.UD05_Column_2 = this._UD05Adapter_2.UD05Data.UD05;
// Initialize EpiDataView field.
this._edvVendorDetail = ((EpiDataView)(this.oTrans.EpiDataViews["VendorDetail"]));
// Set the parent view / keys for UD child view
string[] parentKeyFields = new string[1];
string[] childKeyFields = new string[1];
parentKeyFields[0] = "VendorNum";
childKeyFields[0] = "Key1";
this._edvUD05.SetParentView(this._edvVendorDetail, parentKeyFields, childKeyFields);
string[] parentKeyFields_2 = new string[1];
string[] childKeyFields_2 = new string[1];
parentKeyFields_2[0] = "VendorNum";
childKeyFields_2[0] = "Key1";
this._edvUD05_2.SetParentView(this._edvVendorDetail, parentKeyFields_2, childKeyFields_2);
if ((this.oTrans.PrimaryAdapter != null))
{
this.oTrans.PrimaryAdapter.GetCurrentDataSet(Ice.Lib.Searches.DataSetMode.RowsDataSet).Tables.Add(this._edvUD05.dataView.Table.Clone());
}
}
Using the link below I now get the results from the baq to show up. The issue is that the results are posted into my second epigrid and overwriting the data view that should be there.
What Im looking for right now is a way to get a search dialog to launch and show the results of the baq. Then based on the users selection filter the corresponding data that is in UD05.
Had a call with an Epicor customization team member and got 99% of the way there.
The issue I have now is that when I click save the UD05 table is not updated. If I click save, change what data I have selected and save again then the original data that was changed/updated saves correctly. Below is the code I am using to push the save.
The original error was caused by a naming convention error. The error with the customization not saving was that I was using oTran.Update; instead of my declared _ud05Adapter.Update;. As soon as the swap was made it worked like a charm. The moral of the story, don’t fat finger when coding, it’ll save you a lot of headaches.
Huge props to Dan Godfrey for sitting on the phone with me for an hour and getting me where I needed to be. Couldn’t have got it done without him!