OrderAlloc Adapter GetListOfOrders method whereclause not working

I’m trying to get the OrderAllocList dataset for only one row. I’m using the GetListOfOrders method in the OrderAlloc adapter to achieve this, but the filter in the whereclause doesn’t seem to be working. When displaying the row count it’s showing the count of all the OrderAllocs that are available, even though i expect it to be only 1.

I also tried using GetRows, GetList, InvokeSearch methods with the same filter but without any luck.

My code is as following:

 private void btnAllocate_Click(object sender, System.EventArgs args)
    		// ** Place Event Handling Code Here **
    		edvAllocateSummary = ((EpiDataView)(this.oTrans.EpiDataViews["AllocateSummary"]));
    		edvAllocateByLotBin = ((EpiDataView)(this.oTrans.EpiDataViews["AllocateByLotBin"]));
    		OrderAllocAdapter oaAdapter = new OrderAllocAdapter(oTrans);
    		foreach(System.Data.DataRowView row in edvAllocateSummary.dataView)
    			if((bool)row["Calculated_Selected"] == true)
    				System.Collections.Hashtable hash = new System.Collections.Hashtable();
    				string cWhere = "OrderRel.OrderNum = " + row["OrderRel_OrderNum"] + " and OrderRel.OrderLine = " + row["OrderRel_OrderLine"] + " and OrderRel.OrderRelNum = " + row["OrderRel_OrderRelNum"];

    				SearchOptions opts = new SearchOptions(SearchMode.AutoSearch);
                	opts.DataSetMode = DataSetMode.RowsDataSet;
    				opts.NamedSearch.WhereClauses.Add("OrderRel", cWhere);
    				bool morePages = false;
    				OrderAllocListDataSet oaDs = (OrderAllocListDataSet)oaAdapter.GetListOfOrders(opts, out morePages);
    		MessageBox.Show(oaDs.OrderAllocList[0].OrderNum + " " + oaDs.OrderAllocList.Rows.Count+"");

Am i doing something wrong? Or should I use another method?

1 Like

Hi @Brian,

Before you call GetListOfOrders(); you need to run the search option filter. If you run the following it should invoke the search and only return the where clause rows.


I hope this helps.


Hi @Alphanu,

Thank you for your reply.

I tried adding the InvokeSearch method before executing the GetListOfOrders. Unfortunately this didn’t solve the issue either. After printing the count of rows of oaDs.OrderAllocList it still shows all rows and the count of the oaAdapter.OrderAllocList.OrderAllocList is 0.

I also tried executing the method with the same Whereclause in the BLTester. In here it does work and it shows 1 row in the Results tab.

I’ve run into the same issue. This particular data adapter doesn’t work with the search options in Epicor 10.2.300.10. No errors display so, not sure why this adapter works differently than other adapters. However, it is different from other adapters. Since Epicor doesn’t invest in detailed documentation of their adapters for screen customization, I did research based on this article on how to work with this adapter. What I found is that it is unlike any other adapter I have worked with in Epicor. In short GetLIstOfOrders needs to be passed as a parameter to this convoluted version of the Search engine. Below is sample code of how I got it to work.


		bool morePages;
		Ice.Lib.Searches.SearchOptions opts = new SearchOptions(SearchMode.AutoSearch);

        //Some very "Special" set up for doing searches with this adapter that are not documented anywhere
        //and is different than any other adapter we have worked with.
		_adOrderAlloc.DefaultSearchType = Erp.Adapters.OrderAllocAdapter.SearchType.SO;
		_adOrderAlloc.SearchForm = new Erp.UI.Searches.OrderSearchForm();
		opts.SearchMethod = new AlternateSearchMethod(_adOrderAlloc.GetListOfOrders);
		opts.SelectMode = SelectMode.MultiSelect;
		string _filter = "OrderNum = " + OrderNum.ToString() + " AND OrderLine = " + OrderLine.ToString();
		opts.PreLoadSearchFilter = _filter;


		//Need to mimic the client and set the row and dataset

As you can see, in the case of this adapter, Epicor did not follow the coding standards they established with other adapters. Just another example of why we need to let Epicor know that they need to provide better technical and design documentation for doing customizations.