GetRows on Sales Order Adapter Hanging Me Out To Dry

Hey there,

I’m working in UD106, and entering sales order-related data.

Trying to validate an order line with:

Ice.Lib.Searches.SearchOptions opts = new SearchOptions(SearchMode.AutoSearch);
opts.DataSetMode = DataSetMode.RowsDataSet;
bool morePages = false;
opts.PageSize = 0;
string whereClause = "OrderNum = '" + orderNum.ToString() + "' AND OrderLine = '" + orderLineNum.ToString() + "'";
MessageBox.Show("point 5 whereclause " + whereClause);
opts.NamedSearch.WhereClauses.Add("OrderDtl",whereClause);
MessageBox.Show("point 6");
**var dsOrder = (Erp.BO.SalesOrderDataSet)adapterOrder.GetRows(opts,out morePages);**
MessageBox.Show("line " + dsOrder.OrderDtl[0].OrderLine.ToString());

After “point 6” above, Epicor thinks a while and stops responding. It never makes it to the final MessageBox. I have to kill Epicor.

Here’s the where clause from the message box at point 5:

image

And my assembly references:

image

I’m able to do a GetByID and could make that work, but it seems like a lot of overhead when I need only the one row.

Anyone?

Thanks,

Joe

Hi Joe,

Try lose the single quotes since ordernum and orderline are integers.

Ross

Thanks, Ross. Good spot, but it still hangs. Dunno.

Did you already connect to the sales order adapter with the BOConnect method?

Hi Aaron,

Yes, the GetByID in that spot works okay. It just hangs when I do the GetRows.

I went ahead and used the GetByID because I didn’t want to keep charging the customer for a marginal time savings. :slight_smile:

But I would be interested in being able to make it work.

Thanks,

Joe

Did you try running customization in debug mode with visual studio? You might be able to get more information about why it’s hanging up.

I never used NamedSearch, did you mean to make a RuntimeSearch?

// create Hashtable of tableName
System.Collections.Hashtable myHash = new System.Collections.Hashtable();
string wClause = "Key1 = '" + key1 + "'";

// add table name (key) and where clause to Hashtable
myHash.Add("UD100A", wClause);

// Create SearchOptions object
SearchOptions opts = Ice.Lib.Searches.SearchOptions.CreateRuntimeSearch(myHash, DataSetMode.RowsDataSet);

// Call Adapter InvokeSearch()
ud100Adapter.InvokeSearch(opts);

Im assuming

since you didnt specify an actual NamedSearch ID, it probably is just getting you all the Details it can find in the entire system. Use RuntimeSearch.


Lately I always use BOReader… but man if I remember correctly the Epicor searches some of them, did a post-filter and didnt filter during the SQL Query. Kind of a… “get me all”, “then filter”.

1 Like

Cool.

Thanks!

Although the runtime search worked, it still took a long time to run, so I wound up using something different.

All I needed to know is if there was an existing order line. Here’s what I ended up with:

bool result = false;

OrderDtlSearchAdapter adapterOrder = new OrderDtlSearchAdapter(this.oTrans);
adapterOrder.BOConnect();

	bool found = adapterOrder.GetByID(Convert.ToInt32(quoteOrderNum), Convert.ToInt32(quoteOrderLineNum));
	if (found) result = true;
	/*
	foreach(DataRow row in adapterOrder.OrderDtlSearchData.OrderDtl)
	{
		if (Convert.ToInt32(row["OrderLine"]) == quoteOrderLineNum) result = true;
	}
	*/

adapterOrder.Dispose();

if (!result)
{
	intQuoteOrderLine.Value = 0;
	throw new Ice.BLException("This is not a valid order.");
}

Thanks, all.

Joe