Use JobEntry adapter to create JobMtl (Why is it so slow when call adapter.GetList?)

Hi there!
I’m using JobEntry adapter to create New JobMtl.
in my STEP 1: adapterJobEntry.GetList took me 3minutes to retrieve a list… :smiling_face_with_tear: :smiling_face_with_tear: :smiling_face_with_tear: :smiling_face_with_tear:
Any idea how to get this fixed?

Below are my snip code

//STEP 0: Call Jobentry BO
JobEntryAdapter adapterJobEntry = new JobEntryAdapter(this.oTrans);
adapterJobEntry.BOConnect();

//STEP 1: GetList
bool blnout = false;
string strWherClause = "(Plant = 'MfgSys') AND JobNum >= '' AND Jobclosed = false and JobComplete = false AND JobNum ='"+JobNum+"'";
Ice.Lib.Searches.SearchOptions opts = new Ice.Lib.Searches.SearchOptions(Ice.Lib.Searches.SearchMode.AutoSearch);
//Ice.Lib.Searches.SearchOptions opts = new SearchOptions(SearchMode.AutoSearch);	
opts.PreLoadSearchFilter = "JobNum ='"+JobNum+"'";
opts.NamedSearch.WhereClauses.Add("JobHead", strWherClause);
adapterJobEntry.GetList(opts, out blnout);

//STEP 2: GetDatasetForTree
adapterJobEntry.GetDatasetForTree(JobNum, 0, 0 , false,"MFG,PRJ,SRV");

//STEP 3: GetNewJobMtl
adapterJobEntry.GetNewJobMtl(JobNum, AssSeq);

//STEP 4: ChangeJobMtlPartNum
string vmsgtxt ="", vmsgtype="", opMtlIssuedAction="";
bool first,second;
bool third = true;
adapterJobEntry.ChangeJobMtlPartNum(false, ref PartNum, Guid.Empty, "", "" ,out vmsgtxt ,out first,out vmsgtype,out second,out third,out opMtlIssuedAction);
//STEP 5: ChangeJobMtlQtyPer
//Set QtyPer
	int x =0;
foreach(DataRow row in adapterJobEntry.JobEntryData.JobMtl.Rows)
	{ 
		if(row["RowMod"].ToString()== "A")
		{
			DataRow dataRowEdit = adapterJobEntry.JobEntryData.JobMtl.Rows[x];
			try{
				dataRowEdit.BeginEdit();
				dataRowEdit["QtyPer"] = qtyper;
				dataRowEdit["FixedQty"] = FixedQty;
				dataRowEdit["AddedMtl"] = AddedMaterial;
				dataRowEdit.EndEdit();  
			}
			catch (Exception ex){}
		}
		x++;
	}
adapterJobEntry.ChangeJobMtlQtyPer();

//STEP 6: ChangeJobMtlEstSplitCosts
adapterJobEntry.ChangeJobMtlEstSplitCosts();

//STEP 7: ChangeJobMtlFixedQty ,if true/checked then run
if(FixedQty){adapterJobEntry.ChangeJobMtlFixedQty();}

//STEP 8: Update
adapterJobEntry.Update();

//STEP 9: Dispose
adapterJobEntry.Dispose();

Solved!
I replace adapterJobEntry.GetList with adapterJobEntry.GetByID

1 Like