Filtering epiUltraGrid with a BAQComboBox

I finally got this working! Thank you so much for the time you put in to explaining this for me. Here is my implementation.
I made a BAQ called getPartRev:

select 
	[PartRev].[RevisionNum] as [PartRev_RevisionNum]
from Erp.PartRev as PartRev
where (PartRev.PartNum = @part)

After I enter a part number I update the combobox datasource using a dynamic query. Then I refresh the combo box to show just the revs for that part:

private void txtMyPart_Leave(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
		if (txtMyPart.Text!="")  
		{
		getRevs();
		cmbpartrev.ForceRefreshList();
		}
	}

I added the dynamic query to the function getRevs():

	private void getRevs()
	{
		cmbpartrev = (Ice.Lib.Framework.EpiUltraCombo)csm.GetNativeControlReference("8ba6336e-50bb-4814-9f5d-4c85237c4f81");

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

		qeds.ExecutionParameter.AddExecutionParameterRow("part", myPart.Text, "nvarchar", false, Guid.NewGuid(), "A");

		dqa.ExecuteByID("getPartRev", qeds);
		if (dqa.QueryResults.Tables["Results"].Rows.Count > 0)
		{
			cmbpartrev.DataSource = dqa.QueryResults.Tables["Results"];
			cmbpartrev.DisplayMember = "PartRev_RevisionNum";
			cmbpartrev.ValueMember = "PartRev_RevisionNum";
			oTrans.NotifyAll();
		}
	}

I also made sure to define the combobox at the beginning of the class script. This is revCombo:

public EpiUltraCombo cmbpartrev;

To make this work, I had to modify my dashboard tracker view to prompt for part number and rev. I use the native part number text box, but I use customization to hide the native revision text box. This way, I can put the ultra combo box on the customization. Whenever you select a value from the ultracombo, the hidden rev text box gets updated, and the grid refreshed to show the new results.

	private void revCombo_ValueChanged(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
		txtMyRev.Text = revCombo.Text;
		MainController.AppControlPanel.HandleToolClick("RefreshTool", new 		Infragistics.Win.UltraWinToolbars.ToolClickEventArgs(MainController.MainToolManager.Tools["RefreshTool"], null));
	}

So far this seems to work great! I learned a lot through this process. Thank you again!
Nate

1 Like