I have a customization on a UD table utilizing a BAQ Quick Search to load records into the form. Is there a way to limit the search to return only a single record instead of multiple?
You can do this on the BAQ level.
BAQ Designer -> Query Builder -> SubQuery Options -> Result Set Rows -> Top
Rows Number -> there you can set how many rows will be returned.
Thanks, but I need the full set of results from the BAQ to display in the Search form, however, I want the limit user to only be able to select a single record to work on. Some search forms allow multiple records to be selected and others only allow a single record to be selected. For UD forms, the default is multiple and I would like to limit the selection to one.
If you don’t mind replacing the native button and calling your own code to invoke the quick search, you can do it like so. You’ll also want to consider how you want to parse out the return object.
//launch custom quick search and access return object
object ret = ProcessCaller.InvokeAdapterMethod
(oTrans.EpiBaseForm, "QuickSearchAdapter", "ShowQuickSearchForm", new object[]
{oTrans.EpiBaseForm, "YourQuickSearchIDHere", true/* multi-select, enter false for single rec */, new DataTable() });
// user cancelled
if (ret == null) return;
//otherwise, return object is an ArrayList
ArrayList list = (ArrayList)ret;
Thanks for the help Aaron. You got me pointed in the right direction.
Used the Simple Search wizard and modified code to use GetByID from the selected record.
Quick Search assigned to All Occurrences, Base Default and Suppress Base, so it is automatically displayed and the SearchFunctions options allowed setting the single selection.
private void btnSearch_Click(object sender, System.EventArgs args)
{
bool recSelected;
string whereClause = string.Empty;
DataSet dsSearch = Ice.UI.FormFunctions.SearchFunctions.listLookup(this.oTrans, "UD10Adapter", out recSelected, true, whereClause);
if (recSelected)
{
DataRow selectedRow = dsSearch.Tables[0].Rows[0];
string projectID = selectedRow["Key1"].ToString();
oTrans.GetByID(projectID, string.Empty, string.Empty, string.Empty, string.Empty);
}
}