Here is my attempt to create what Daryl is talking about. It doesnât work quite yet, but I feel like I am close. I created a function to load my BAQs into the correct UltraGrids. The code comlies correctly, but errors when I open the form.
public void LoadMyBAQ(string myBAQ, EpiUltraGrid myGrid)
{
Ice.BO.DynamicQueryDataSet dsQuery;
Ice.BO.QueryExecutionDataSet dsBAQ;
//adapter
DynamicQueryAdapter yourbaq = new DynamicQueryAdapter(this.oTrans);
DynamicQueryAdapter termsadp = new DynamicQueryAdapter(this.oTrans);
//results ds
DataTable results;
yourbaq.BOConnect();
string baqname = myBAQ;
dsQuery = termsadp.DynamicQueryData;
//execution ds
dsBAQ = yourbaq.GetQueryExecutionParameters(dsQuery);
yourbaq.Execute(dsQuery, dsBAQ);
//results dt
if (yourbaq.QueryResults != null && yourbaq.QueryResults.Tables.Count > 0)
{
results = yourbaq.QueryResults.Tables["Results"];
}
else
{
results = new DataTable();
}
//set results to ultragrid
myGrid.DataSource = yourbaq.QueryResults.Tables["Results"].DefaultView;
}
I call this inside here:
public void InitializeCustomCode()
{
LoadMyBAQ("x_ThisWeeksUpdate_OpenOrders", epiUltraGridC1);
LoadMyBAQ("x_ThisWeekUpdate_OurUnmatched", epiUltraGridC2);
I debugged in VS and found that the error was in the execute line, perhaps because the datasets were not setup correctly.
Application Error
Exception caught in: mscorlib
Error Detail
Message: Exception has been thrown by the target of an invocation.
Inner Exception Message: Canât find query definition in passed dataset
Program: CommonLanguageRuntimeLibrary
Method: InvokeMethod
Client Stack Trace
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object parameters, Object arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture)
at Ice.Lib.Customization.CustomScriptMethodInvoker.InvokeScriptMethod(MethodInfo scriptMethod, Object parameters)
at Ice.Lib.Customization.CustomScriptMethodInvoker.InvokeInitializeCustomCodeIfExists()
at Ice.Lib.Customization.CustomScriptManager.TryActionShowExceptionBoxOrLogVerificationErrorIfException(Action action, String exceptionBoxTitle)
Inner Exception
Canât find query definition in passed dataset
at Epicor.ServiceModel.Channels.ImplBase`1.ShouldRethrowNonRetryableException(Exception ex, DataSet dataSets)
at Ice.Proxy.BO.DynamicQueryImpl.GetQueryExecutionParameters(DynamicQueryDataSet queryDS)
at Ice.Adapters.DynamicQueryAdapter.GetQueryExecutionParameters(DynamicQueryDataSet ds)
at Script.LoadMyBAQ(String myBAQ, EpiUltraGrid myGrid)
at Script.InitializeCustomCode()
I appreciate any help you can give.
Thanks!
Nate