BAQ Combo - Refresh List With Code

Classic UX Question on a Wednesday:

Does anybody know of a way to get a BAQ Combo Box to “Refresh List” within a C# customization. Normal EpiCombos have an option to “Refresh List”, seen below, but BAQ Combos do not. Because of this, the thought would be to do so with code, so users do not have to exit out of the form and re-enter to have new data enter the BAQ Combo.

Here is code that has been tried, to no avail:

Ice.Lib.Framework.BAQCombo baqComboSpec = (Ice.Lib.Framework.BAQCombo)csm.GetNativeControlReference(“22f6d872-7b26-4da8-b8dc-49913b665b1e”);
baqComboSpec.ForceRefreshList();
baqComboSpec.Refresh();
baqComboSpec.ResetBindings();
baqComboSpec.DataBind();

Thanks
EpiCombo With Refresh List
image

BAQ Combo, no Refresh List
image

I’ve never done this with a BAQ Combo, but filling a grid from the BAQ I use:

	private void FillCustomGrid() {

		using (var dqa = new DynamicQueryAdapter(oTrans)) {


	   		dqa.BOConnect();
	   		QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("MyBAQ"); 
	   		qeds.ExecutionParameter.Clear();
	   

	   		dqa.ExecuteByID("MyBAQ", qeds);
	   		baqGrid.DataSource = dqa.QueryResults.Tables["Results"];
		}
	}

I’m wondering if the Combo would have the same .DataSource property. It would obviously be a little more complex since you’d have to specify a value column and display column,

I have a few customizations where I use the value of one combo to run a BAQ to feed the next combo. When I do that, I use code like that shown below. In this example, getJobs() is called when the focus leaves the previous field. In this case I think it is the oTrans.NotifyAll(); that updates the combo contents after I redefine the source. I could be wrong. Let me know if this works for you!

	private void getJobs()
	{
		cmbJobs = (Ice.Lib.Framework.EpiUltraCombo)csm.GetNativeControlReference("ab3e6a13-bcc2-45bb-8f27-e93f11951026");

		DynamicQueryAdapter dqa = new DynamicQueryAdapter(oTrans);
		dqa.BOConnect();		
		QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("Jobs");
		qeds.ExecutionParameter.Clear();

		qeds.ExecutionParameter.AddExecutionParameterRow("part", MyPartNum.Text, "nvarchar", false, Guid.NewGuid(), "A");
		qeds.ExecutionParameter.AddExecutionParameterRow("rev", epiRevs.Value.ToString(), "nvarchar", false, Guid.NewGuid(), "A");

		dqa.ExecuteByID("Jobs", qeds);
		if (dqa.QueryResults.Tables["Results"].Rows.Count > 0)
		{
			cmbJobs.DataSource = dqa.QueryResults.Tables["Results"];
			cmbJobs.DisplayMember = "JobHead_JobNum";
			cmbJobs.ValueMember = "JobHead_JobNum";
			cmbJobs.DropDownStyle = Infragistics.Win.UltraWinGrid.UltraComboStyle.DropDownList;
			oTrans.NotifyAll();
		}
		else
		{
		MessageBox.Show("No Open Jobs!");
		}
	}
1 Like

Wish I had waited, I’ve been playing with this to see if I could adapt my method above to do this. If I waited a bit I could have just copied yours :man_facepalming: :joy:

1 Like

Hey Nate,

Your code setting the BAQ as the DataSource, combined with NotifyAll() did the trick. Muchas Gracias!

I ended up housing this code in a custom button to refresh list for the BAQ Combo, instead of messing with the Context Menu of the BAQ Combo itself. Our users were fine with this, and it was simpler from my end.

1 Like