Code is not loading the BAQCombo

Guys i am using the code below to load information in a BAQComboBox. The issue is the following
Example
i create sales order let say 123 and i fill the information of the BAQComboBox. After i safe the sales order i load a different sales order lets say 456 then i go back and i load sales order 123 and the BAQCombobox is empty but if you click in the drop down arrow the value of the dropdown is selected but is didnt load with the screen. the BAQCombobox is binding the field Application_c. Please advise

private static void oTrans_ordAdapter_AfterAdapterMethod(object sender, AfterAdapterMethodArgs args)
{
// ** Argument Properties and Uses **
// ** args.MethodName **
// ** Add Event Handler Code **

// ** Use MessageBox to find adapter method name

EpiDataView edvOrderHed = ((EpiDataView)(Script.oTrans.EpiDataViews["OrderHed"]));
switch (args.MethodName)
{
	case "Update":
		baqComboC2.Value = edvOrderHed.dataView.Table.Columns["Application_c"];

		break;
}

}

Show us a screenshot of your BAQ Combo box properties, that’s probably where the issue is.

The BAQ Combo box labeled application is the one with the problem

Not sure why you need after adapter method at all. Because your BAQ Combo is bound to the OrderHed.Application_c field, the value will always be in that control and will change when the data views change.

The problem is the following
When you open order entry the application baq drop down loads the values correctly without problems, but
when order entry menu is already open, but you open a sales order then you load a different sales order the second sales order loaded it not loading the application field info but if you query the data base the field has information

I really think the problem is the after adapter method event you added. There is no need for that as the BAQ Combo control handles all of that natively.
Try commenting out the action in that method and see if it behaves differently.

With out the event is when i have the problem i add this event to try to fix the problem and is not working either

I commented the action and i still have the same problem

Alex,
What is your BAQ querying? Can you share a screenshot of your BAQ?
You shouldn’t need ANY code for a BAQ Combo to work.

1 Like

here is the pic of the BAQ

ha! you are using BAQ Markup… I wonder if that doesn’t work with UD fields… (not sure why it wouldn’t)… can you remove the BAQ Markup and see if that works ok (meaning the value always populates even if its not filtered)

let me try that give me a sec

i removed the markup and now it works

The question would be; how can i filtered and make the BAQ load?

You can add the filter in code… instead of in the BAQ Markup… on a BeforeDropDown Event

ok thanks Jose really appreciated

Jose i was watching your video on youtube on how to code a baq in a customization and i adapted to my code but i would like to know how do i assign the values to the drop down? The code i tried to use were the 2 lines commented at the end of the code.

private static void epiComboC2_BeforeDropDown(object sender, System.ComponentModel.CancelEventArgs args)
{
// ** Place Event Handling Code Here **
DynamicQueryAdapter dqa = new DynamicQueryAdapter(oTrans);
dqa.BOConnect();
QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID(“EII-Cbx-UD102A-Application”);
qeds.ExecutionParameter.Clear();
qeds.ExecutionParameter.AddExecutionParameterRow(“Market”, epiComboC1.Value.ToString(), “nvarchar”, false, Guid.NewGuid(),“A”);
dqa.ExecuteByID(“EII-Cbx-UD102A-Application”,qeds);
//epiComboC2.ValueMember = dqa.QueryResults.Tables[“Results”].Columns[“UD102A_ChildKey1”];
//epiComboC2.DisplayMember =dqa.QueryResults.Tables[“Results”].Columns[“UD102A_Character01”];

}

That should work, are you getting results back from the BAQ run?

I checked the BAQ and it works. also i am getting this error when i dont comment the last 2 lines i get this error please advice.

Error: CS0029 - line 279 (1218) - Cannot implicitly convert type ‘System.Data.DataColumn’ to ‘string’
Error: CS0029 - line 280 (1219) - Cannot implicitly convert type ‘System.Data.DataColumn’ to ‘string’

270- private static void epiComboC2_BeforeDropDown(object sender, System.ComponentModel.CancelEventArgs args)
271- {
272 - // ** Place Event Handling Code Here **
273 - DynamicQueryAdapter dqa = new DynamicQueryAdapter(oTrans);
274 - dqa.BOConnect();
275 - QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID(“EII-Cbx-UD102A-Application”);
276 - qeds.ExecutionParameter.Clear();
277 - qeds.ExecutionParameter.AddExecutionParameterRow(“Market”, epiComboC1.Value.ToString(), “nvarchar”, false, Guid.NewGuid(),“A”);
278 - dqa.ExecuteByID(“EII-Cbx-UD102A-Application”,qeds);
279 - epiComboC2.ValueMember = dqa.QueryResults.Tables[“Results”].Columns[“UD102A_ChildKey1”];
280 - epiComboC2.DisplayMember = dqa.QueryResults.Tables[“Results”].Columns[“UD102A_Character01”];

}

Jose, could you please look at line 279 and 280 and let me know what i have wrong?