POEntry Customization - BAQ Adapter Exception

Hello everyone,

I have run into a problem while customizing “Purchase Order Entry”.
I have added another EpiUltraTable and am trying to populate it using the DynamicQuery Adapter.
Here’s my customization code:

	private void epiPONumBox_TextChanged(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
		if (this.epiPONumBox.Text.Length > 0)
		{
			string poNum = this.epiPONumBox.Text;

			DynamicQueryAdapter dqa = new DynamicQueryAdapter(POEntryForm);
			dqa.BOConnect();
			QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("POEntryAllTab");
			qeds.ExecutionParameter.AddExecutionParameterRow("ponum", poNum, "int", false, Guid.NewGuid(),"A");
			dqa.ExecuteByID("POEntryAllTab",qeds);
			
			this.AllLinesCustomGrid.DataSource = dqa.QueryResults.Tables["Results"];

			dqa.Dispose();
		}
	}

Here’s my “POEntryAllTab” BAQ Parameter:

Here is the error I’m getting:
image
“The parameter ‘ponum’ has no value specified and empty value is not allowed.”
The BAQ’s parameter works as expected when using it inside the BAQ. Also, I’ve made sure that the value passed into the “AddExecutionParameterRow” method is the actual PO Number as well.

Here’s the detailed Error Message:

Client Stack Trace 
==================
   at Epicor.ServiceModel.Channels.ImplBase`1.ShouldRethrowNonRetryableException(Exception ex, DataSet[] dataSets)
   at Ice.Proxy.BO.DynamicQueryImpl.ExecuteByID(String queryID, QueryExecutionDataSet executionParams)
   at Ice.Adapters.DynamicQueryAdapter.ExecuteByID(String pcQueryId, QueryExecutionDataSet ds)
   at Script.epiPONumBox_TextChanged(Object sender, EventArgs args)
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnTextChanged(EventArgs e)
   at Ice.Lib.Framework.EpiTextBox.OnTextChanged(EventArgs e)
   at Infragistics.Win.UltraWinEditors.TextEditorControlBase.set_Text(String value)
   at Ice.Lib.Framework.EpiTextBox.oDataView_EpiViewNotification(EpiDataView view, EpiNotifyArgs ar)
   at Ice.Lib.Framework.EpiViewNotification.Invoke(EpiDataView view, EpiNotifyArgs args)
   at Ice.Lib.Framework.EpiDataView.OnEpiViewNotification(EpiNotifyArgs e)
   at Ice.Lib.Framework.EpiDataView.InnerNotify(EpiNotifyArgs args)
   at Erp.UI.App.POEntry.Transaction.GetPOData(Int32 poNum)

I’ve used this approach before and it worked, but there’s no success today.

Has anyone had this issue before?

Thank you!

Wow okay so right after I post this, I find the solution…
Might as well leave it for others in case they run into this.

QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("POEntryAllTab");

sets the parameters for qeds and must have set “ponum” to null once already.
When adding a new ExecutionParameter:

qeds.ExecutionParameter.AddExecutionParameterRow("ponum", poNum, "int", false, Guid.NewGuid(),"A");

I wasn’t overriding the first parameter, but adding another one. When the BAQ is executed, it’s reading the first parameter, which is empty, and throwing the exception.

The solution is to replace

QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("QueryID");

with

QueryExecutionDataSet qeds = new QueryExecutionDataSet();
1 Like