I have dug through some other posts and I still am blind to what I am missing. I am setting the value of the FromWarehouse on the Issue material screen in Epicor. I have the following code that properly sets the value of the field but I can’t get the dropdown to update. If I click the arrow of the dropdown the UI fires and it shows the selected value without me needing to do anything. Does anyone know what I am missing?
EpiUltraCombo txtFromWarehouseCode2;
txtFromWarehouseCode2 = (EpiUltraCombo)csm.GetNativeControlReference("d8cbd6bd-beed-4ca7-803c-f5a1023e4bbd");
txtFromWarehouseCode2.Focus();
txtFromWarehouseCode2.Update();
txtFromWarehouseCode.Value = toWarehouse;
txtFromWarehouseCode.Text = toWarehouse;
txtFromWarehouseCode.Refresh();
txtFromWarehouseCode.ForceRefreshList();
Edge
(Stephen Edginton)
January 17, 2020, 9:32am
2
Hi @bfraseraepl if you take a look at the Customization User Guide
it details how this works
Also there are many examples in this forum if you search for epidataview
Thanks for the reply. I was misunderstanding that I had to update the dataview as well. Now that I understand that I can see the numerous examples. I’ll give it a try - thanks again.
I reviewed the code in the Customization guide but I am still missing something. My text field updates but my combo doesn’t until I click the UI. Below is my code changing the dataview:
IM.dataView[IM.Row][“FromWarehouseCode”] = toWarehouse;
IM.dataView[IM.Row][“FromBinNum”] = toBin;
I see in the documentation it talks about a Notify. Is that triggers the drop down? I don’t appear to have to do that to get the text field to work.
private void oTrans_imAdapter_AfterAdapterMethod(object sender, AfterAdapterMethodArgs args)
{
// ** Argument Properties and Uses **
// ** args.MethodName **
// ** Add Event Handler Code **
// ** Use MessageBox to find adapter method name
// EpiMessageBox.Show(args.MethodName)
switch (args.MethodName)
{
case "OnChangeToJobSeq":
var IM = oTrans.Factory("IM");
if(IM == null || IM.Row < 0) return;
if((decimal)IM.dataView[IM.Row]["TranQty"] == 0)
{
decimal toIssue = (decimal)IM.dataView[IM.Row]["QtyRequired"] - (decimal)IM.dataView[IM.Row]["QtyPreviouslyIssued"];
;
if(toIssue > 0) { IM.dataView[IM.Row]["TranQty"] = toIssue; }
//MessageBox.Show(toIssue.ToString());
//Changed to 51REG3 on 1/16/2020 for new Job Bin Warehouse
if(IM.dataView[IM.Row]["FromWarehouseCode"].ToString() == "51REG1") {
//MessageBox.Show(IM.dataView[IM.Row]["FromWarehouseCode"].ToString());
//IM.dataView[IM.Row]["FromBinNum"] = "";
//IM.dataView[IM.Row]["FromBinNumDescription"] = "";
String ToJobNum = (string)IM.dataView[IM.Row]["ToJobNum"];
String ToAssemblySeq = (string)IM.dataView[IM.Row]["ToAssemblySeq"].ToString();
String ToJobSeq = (string)IM.dataView[IM.Row]["ToJobSeq"].ToString();
EpiTextBox txtFromBinNum;
txtFromBinNum = (EpiTextBox)csm.GetNativeControlReference("4d7e0cd4-7323-48e9-8409-7af91c1b8216");
txtFromBinNum.Focus();
EpiUltraCombo txtFromWarehouseCode;
txtFromWarehouseCode = (EpiUltraCombo)csm.GetNativeControlReference("d8cbd6bd-beed-4ca7-803c-f5a1023e4bbd");
DynamicQueryAdapter dqa = new DynamicQueryAdapter(oTrans);
dqa.BOConnect();
QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("IssueMaterialHelper");
qeds.ExecutionParameter.Clear();
qeds.ExecutionParameter.AddExecutionParameterRow("JobNum", ToJobNum, "nvarchar", false, Guid.NewGuid(),"A");
qeds.ExecutionParameter.AddExecutionParameterRow("AssemblySeq", ToAssemblySeq, "nvarchar", false, Guid.NewGuid(),"A");
qeds.ExecutionParameter.AddExecutionParameterRow("MtlSeq", ToJobSeq, "nvarchar", false, Guid.NewGuid(),"A");
dqa.ExecuteByID("IssueMaterialHelper",qeds);
DataTable dt = dqa.QueryResults.Tables["Results"];
string toWarehouse = "51REG3";
string toBin = dt.Rows[0][21].ToString();
//MessageBox.Show(IM.dataView[IM.Row]["FromWarehouseCode"].ToString());
//MessageBox.Show(toBin);
try {
//MessageBox.Show(toWarehouse);
IM.dataView[IM.Row]["FromWarehouseCode"] = "51REG3";
MessageBox.Show(IM.dataView[IM.Row]["FromWarehouseCode"].ToString());
txtFromWarehouseCode.Text = "Brad";
//MessageBox.Show(txtFromWarehouseCode.Value.ToString());
IM.dataView[IM.Row]["FromBinNum"] = toBin;
//MessageBox.Show("set from bin to Bin");
} catch(Exception e)
{
MessageBox.Show("Doesn't appear to be picked.");
//MessageBox.Show(e.Message.ToString());
}
}
oTrans.NotifyAll();
}
I was missing the fact that there was a separate field in the dataview for the description. After I set it with the following code it had the desired outcome:
IM.dataView[IM.Row][“FromWarehouseCodeDescription”] = “Job Bin”;
1 Like