Updatable BAQ Drop Down using another BAQ

I have an updatable BAQ with Filed Editors to eliminate user error when entering in data. It is a drop and I am pulling the data from another BAQ to populate the drop down. My issue is the updatable BAQ will be linked to Dashboard browser to Order Head order number. How can I make the drop down BAQ populate the order number that is selected in Order head. I cannot figure this out at all the drop down pulls in ever order and I just want it linked to the order number the user has selected.

I tackled something like this when making my Add/Edit any op dashboards. You can find the details here:

The important part for me was that I wanted to see all the Revs for a part. I made both the Part and Rev fields native to the dashboard in a tracker view. I set both to visible and prompt. This creates native textboxes in my dashboard.
1

Now open your dashboard in customization mode. Make sure the part and rev fields are set with the correct EpiBindings back to your dashboards BAQ. Hide the Rev text box, by selecting it and changing the Visible property to False. Now add a combo box, and place it where you expect to see the rev combo (where the text box originally was).

Next there are a couple of crucial bits of code to populate the combo box. First is the bit to initialize everything. The next bit detects when you leave the part number box. This tells the combo box that a valid part number is ready and now you can pull the revs for that part. I couldn’t get the wizard to work for this, so you have to manually add the Initialize and Destroy custom code lines. And Then there is the getRevs() bit that actually updates the combo box with the correct BAQ and parameter.

//Initialize
public EpiTextBox txtMyPart;
public EpiUltraCombo cmbpartrev;
txtMyPart = (EpiTextBox)csm.GetNativeControlReference("5678fb25-ccec-4ff9-ba79-48c2d550a09e"); //whatever the EpiGuid is for your box.
this.txtMyPart.Leave += new System.EventHandler(this.txtMyPart_Leave);


//Destroy
this.txtMyPart.Leave -= new System.EventHandler(this.txtMyPart_Leave);


private void txtMyPart_Leave(object sender, System.EventArgs args)
	{
		if (txtMyPart.Text!="")  
		{
		getRevs();
		cmbpartrev.ForceRefreshList();
		}
	}


private void getRevs()
	{
		cmbpartrev = (Ice.Lib.Framework.EpiUltraCombo)csm.GetNativeControlReference("8ba6336e-50bb-4814-9f5d-4c85237c4f81"); //whatever the EpiGuid is for your combo box
		DynamicQueryAdapter dqa = new DynamicQueryAdapter(oTrans);
		dqa.BOConnect();		
		QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("getPartRev"); //this is the name of the baq to feed you combo box.
		qeds.ExecutionParameter.Clear();
		qeds.ExecutionParameter.AddExecutionParameterRow("part", myPart.Text, "nvarchar", false, Guid.NewGuid(), "A"); // This is the name of your BAQ parameter

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

You have to adjust your BAQ for the combo box to include a parameter. In my case, for the part number. getPartRevs looks like this:

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

You will also need some code to update the hidden rev text box whenever you change a value in the combo box. This will keep the EpiBinding happy. Something like this is generated well from the wizard:

private void revCombo_ValueChanged(object sender, System.EventArgs args)
{
	txtMyRev.Text = revCombo.Text;
}

There is a lot more in the dashboards. I think I might have left something out, but this should get you close.
Good luck!
Nate