SearchOptions Taking 20+ Minutes To Return Results. Please Help!

Good morning brains! I’m trying to perform a search on QuoteDtl for a specific QuoteNum using the SearchOptions. I’ve used this process for the QuoteHed table and had fast results, but this one is taking 20+ minutes to return results. I’m using this in customization code for a dashboard.

Here is my code for this…

bool morePagesDtl = false;
string whereClauseDtl = “QuoteNum = ‘78063’”;

QuoteAdapter qDtlAdapt = new QuoteAdapter(oTrans);
qDtlAdapt.BOConnect();
SearchOptions optsDtl = new SearchOptions(SearchMode.AutoSearch);
optsDtl.NamedSearch.WhereClauses.Add(“QuoteDtl”, whereClauseDtl);
DataSet qDtlDataSet = qDtlAdapt.GetRows(optsDtl, out morePagesDtl);

MessageBox.Show("Row count: " + qDtlDataSet.Tables[0].Rows.Count.ToString());

And when it finally does return the results, it shows 16,479 rows gone through when it should only be 10…

Any ideas why it would take so long, instead of quickly returning the 10 rows for the specific quote? Thanks for your time and any help you can give.

I say you should start a new BAQ and sett it up similarly. If your BAQ returns 16k rows, then you can at least look at them and begin to understand what other filters or criteria you might need.

1 Like

Guessing the formatting is off here and the search isn’t picking up your where clause. Maybe those single quotes you have around the number?

1 Like

Not sure why GetRows is not picking it up, but try GetList like this

optsDtl.NamedSearch.WhereClauses.Add("BaseList", whereClauseDtl);
DataSet qDtlDataSet = qDtlAdapt.GetRows(optsDtl, out morePagesDtl);

Or this

string quoteNum = "78063"
Hashtable wHash = new Hashtable();
wHash.Add("BaseList", "QuoteNum = '" + quoteNum + "'");
SearchOptions opts = SearchOptions.CreateRuntimeSearch(wHash,DataSetMode.ListDataSet);
qDtlAdapt.InvokeSearch(opts)
1 Like